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
Is there a way to transform new data after fitting with FAMD? #56
Comments
Hey, I'm not exactly sure what you're trying to do, could you possible provide a more complete example? Normally if you call the |
Hi Max, In sklearn I could have: a = [some data] a0 = a[:n] Basically performing the PCA on part of the data and then using it to transform another unseen portion of data. Is it possible to do this with the MCA or FAMD modules in Prince? Cheers, Kuhan |
It should be possible, but it looks something is going wrong... I'll look into now. |
Thanks for the reply. Let us know how it goes! Cheers, Kuhan |
Well I think I fixed the issue for the |
Hi Max, No. See below: X = pd.DataFrame( famd.fit(X[:4]) famd.transform(X[4:]) ValueError Traceback (most recent call last) c:\users\wangku\appdata\local\continuum\anaconda3\envs\tensorflow-gpu\lib\site-packages\prince\mfa.py in transform(self, X) c:\users\wangku\appdata\local\continuum\anaconda3\envs\tensorflow-gpu\lib\site-packages\prince\mfa.py in row_coordinates(self, X) c:\users\wangku\appdata\local\continuum\anaconda3\envs\tensorflow-gpu\lib\site-packages\prince\mfa.py in _row_coordinates_from_global(self, X_global) c:\users\wangku\appdata\local\continuum\anaconda3\envs\tensorflow-gpu\lib\site-packages\prince\pca.py in row_coordinates(self, X) ValueError: shapes (2,11) and (12,2) not aligned: 11 (dim 1) != 12 (dim 0) If you fit on the first three rows rows X[:3] and try to transform the last three X[3:] it will work. Something to do with the shape? Cheers, Kuhan |
I think I know what this is due to. I'll fix it over the weekend :) |
@kuhanw sorry for the delay, can you install the latest code from GitHub and tell me if it works? It should do. You can install it by running |
I did some quick testing and it seemed to work. I will try it on some more complicated datasets later and see if it holds. Thanks for looking into this. Cheers, Kuhan |
Hi, i'm getting the same issue |
This is also happening to me now with FAMD |
This issue is back in 0.7.1 |
Hello,
I just discovered this package and it seems very interesting. I was wondering is there a way to apply the transform function to new unseen data after calling FAMD fit? Analogous to how PCA works in sklearn.
When I try to do this I get an error:
X)
102 X = self.scaler_.transform(X)
103
--> 104 return pd.DataFrame(data=X.dot(self.V_.T), index=index)
105
106 def row_standard_coordinates(self, X):
ValueError: shapes (2,20) and (49,2) not aligned: 20 (dim 1) != 49 (dim 0)
Basically it looks like it doesn't understand there are a different number of "training examples" as opposed to when the fit occurred.
Cheers,
Kuhan
The text was updated successfully, but these errors were encountered: