Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can you "project" new samples onto the L and S Matrices #9

Open
tinyheero opened this issue Oct 28, 2021 · 0 comments
Open

Can you "project" new samples onto the L and S Matrices #9

tinyheero opened this issue Oct 28, 2021 · 0 comments

Comments

@tinyheero
Copy link

Hi there,

Thanks for this package and your implementation of the randomized robust PCA method in the functon rrpca.

Once you have applied rrpca to some training data to learn the L and S matrices, is there a way to project new data onto these matrices to extract the corresponding L and S values for these new data? The rationale is to prevent the "re-learning" of the L and S matrix for each new data sample if I were to take the approach of just including the new sample in the input matrix to rrpca.

In other words, I am looking for something eqivalent of projecting a new sample onto an existing PCA space in a standard PCA analysis. For instance:

training_data <- USArrests[1:48, ]
new_data <- USArrests[49:50, ]
pr_out <- prcomp(training_data, scale = TRUE)
scale(new_data, pr_out$center, pr_out$scale) %*% pr_out$rotation
                PC1        PC2        PC3        PC4
Wisconsin 2.1059185 -0.6184669 -0.1558858  0.1897872
Wyoming   0.6759575  0.3035009 -0.2465021 -0.1636568

With these principal component (PC) values, I could then do something like subtracting them from the new data to clean up the input signal (assuming that the PC values represent noise in the system):

Is there an equivalent of this with rrpca with something like this:

rrpca_out <- rsvd::rrpca(training_data)
predict(rrpca_out, new_data)

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant