-
Notifications
You must be signed in to change notification settings - Fork 20
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
Supervised (kernel) PCA #235
Comments
Hi @n0rdp0l, thanks for the suggestion and the provided details! I wasn't familiar with supervised PCA, but I’ve briefly skimmed the papers and it does seem quite interesting. I agree that this could be valuable for the climate/forecasting community. From what I’ve seen so far, it looks feasible to implement SPCA within the existing xeofs framework. Unfortunately, I’m a bit tied up over the next few months, so I’m unlikely to be able to lead this effort. However, I’d be happy to offer guidance and support to ensure a smooth integration into xeofs. Here are a few starting points (though please note, I’m not yet fully familiar with the internals of supervised PCA and I’m unsure about the exact preprocessing steps for target data
That’s what I have in mind for now. If you decide to move forward with this, I’d be more than happy to assist further. |
Hey @nicrie, Thanks for the quick response! I’ll be applying this technique in a research project focused on a climate ML pipeline that also uses xarray. This will take precedence over the coming weeks, but afterward, I should be in a good position—both in terms of time and understanding—to implement this into xeof. I'll keep you posted. I was particularly interested in the kernelized version of this approach. However, one challenge I'm encountering is that in kernel (supervised) PCA, the projection directions U aren’t directly available (page 10). From what I understand, this happens because the SVD is performed on the kernel matrix rather than the mapped data in the higher-dimensional space. This seems to complicate the kernelized implementation, especially since xeof’s component scores and resulting plots depend on those projection directions, right? That said, I noticed you previously worked on ROCK PCA, where you were able to extract U using SVD, so I’m wondering if perhaps I’ve misunderstood something here. Edit: Actually after going into it a bit more now i saw that you said you had issues with the ROCK implementation and I might be wrong about this but in the matlab code of rock they use eig() which extracts the right eigenvectors, i.e., V, while the python adaptation that you used is extracting the left eigenvectors U, via numpy.linalg.svd(). |
Pretty good point that you raise there. I did not think too much about the kernelized version but now that you mention it, yeah I remember that this was a tricky part... Disclaimer: I'm not an expert in kernel PCA. I will start answering your message from the end:
I'm not sure what you mean with right eigenvectors? Perhaps I'm wrong here, but let's consider right? Then, right-multiplying the equation by so the left singular vectors of
Yeah, that's also my understanding. I cannot currently open the tutorial paper you linked to, but from my understanding of kernel PCA the eigenvectors of the kernel matrix are the non-linear kernel PCs, i.e. the time series. This is because kernel PCA works with the dual-representation of the problem. In general, with kernel PCA, you don't have direct access to the spatial patterns. When you are with standard (linear) PCA, you can just project your data onto your eigenvectors (no matter what they actually represent, the spatial or temporal patterns (similar to PCA S-mode vs. T-mode) to obtain the corresponding missing part. In kernel PCA, as far as I know, you cannot, which leads you to what is often called the pre-image problem. And it's here where my superficial understanding quickly gets muddy. If I remember correctly, the ROCK-PCA paper just took the linear projection as in standard PCA as an approximation for the spatial patterns. Another approach by A. Hannachi et al. is to make composite maps based on the kernel PCs (e.g. Fig. 4 c-f). |
Hi @nicrie, Thanks for the explanation! While trying to wrap my head around the kernelized approach, I might have confused myself a bit by taking "the projection directions U aren’t directly available" too literally. I realized that the roles of U and V in the SVD can change of course depending on whether the input matrix is transposed, which is exactly the case in xeof as you mentioned. Additionally, I overlooked that in the ROCK code, the SVD is applied to the kernel matrix rather than the (subsequent) instead of the more general: , i.e., the left and right singular vectors are essentially the same (up to a transpose), as you mentioned above. Apologies for the confusion! |
Is your feature request related to a problem? Please describe.
Scikit-learn does not currently support supervised Principal Component Analysis (PCA) as it is considered not broadly applicable in the general context of machine learning see this discussion. However, within climate science, supervised dimensionality reduction techniques are more commonly used to capture dependencies between variables, as evidenced by studies like this one and this one.
Describe the solution you'd like
I would like to propose the integration of supervised dimensionality reduction mechanisms into
xeofs
, or an evaluation of the feasibility of implementing these techniques. This would allow users in specialized fields, like climate science, to leverage the power of supervised PCA for more effective data modeling.Additional context
If there is interest in integrating supervised PCA or similar methods, I would be happy to contribute to the implementation and assist in adapting the techniques to fit the structure and goals of
xeofs
.Here is the original paper referenced in the scikit post and here is a tutorial paper already including python code for implementation of the techniques.
The text was updated successfully, but these errors were encountered: