Here, we use MNIST package developped by @stillmatic as sample data.
You can install this package like the following:
Once you install stillmatic/MNIST, MNIST data is
exported as MNIST::mnist_train.
Example the number 8
There are 60,000 records in the data, it is little bit too much data for usual SVD (for usual PC).
That’s why we would like to do sampling here.
Plot the original data on the first and second singular vector plane.
# Last column is y column
x <- as.matrix(df[, -ncol(df)])/255
y <- df$y
frequentdirections::plot_svd(x, y)
#> Warning: `aes_string()` was deprecated in ggplot2 3.0.0.
#> ℹ Please use tidy evaluation idioms with `aes()`.
#> ℹ See also `vignette("ggplot2-in-packages")` for more information.
#> ℹ The deprecated feature was likely used in the frequentdirections package.
#> Please report the issue at
#> <https://github.com/shinichi-takayanagi/frequentdirections/issues>.
#> This warning is displayed once per session.
#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
#> generated.