-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
Inconsistency between fastica and FastICA #14988
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
Comments
sources = np.dot(self.components_, X.T) with the current code (always and
no matter what is the value of whiten)
It does apply the unmixing transformation to the data (taking into account
the whitening done prior to calling the fastica code).
are you still confused?
|
Sorry I'm still confused. This is unrelated to The problem is that both
from sklearn.datasets import load_digits
from sklearn.decomposition import FastICA, fastica
import numpy as np
X, _ = load_digits(return_X_y=True)
whiten = True
est = FastICA(n_components=7, random_state=0, whiten=whiten).fit(X)
print(est.components_[0]) # print first comp
K, W, _ = fastica(X, n_components=7, random_state=0, whiten=whiten)
print(W.dot(est.whitening_)[0]) # equal to first comp
# according to the doc W is supposed to be the same as components_ but that's
# clearly not the case. |
fastica estimates an unmixing matrix (square) from whitened data
(K.dot(X.T))
now if I give you X and you want to know what is the linear operator to go
from X
to independant sources you are asking me what is the unmixing matrix (it
unmixes
the X to get unmixed / independant sources). This matrix that we call
components_
in FastICA contains the whitener times the fastica output obtained from
whtened data.
if you want you can document components_ as the "linear operator to apply
to the data
to get the independent sources"
|
OK so:
Feel free to disagree but I see that as a problem. |
OK so:
1.
the docs are wrong and must be updated
let's say they must be clarified....
1.
fastica and FastICA do not have the same API: it is impossible to
retrieve W (as returned by fastica) if you use FastICA.
ok. If you want to use FastICA in fastica you need to add 2 attributes to
FastICA:
unmixing_matrix_
whitener_
and clarify that components_ is the "linear operator to apply to the data
to get the independent sources. Made using unmixing_matrix_.dot(whitener_)
if whiten is set to True"
or something like that
… |
fastica
returnsW
which is, according to the docs "the unmixing matrix"FastICA
has acomponents_
attribute which is also "the unmixing matrix"But they are not equal when
whiten
is True:I don't know whether this is a bug (I hope it is), but if it's not the doc should be updated.
ping @agramfort
The text was updated successfully, but these errors were encountered: