'Fit the model
Parameters
X : array-like, shape (n_samples, n_features)
Training data, where n_samples is the number of samples
and n_features is the number of features.
compute_sources : bool
If False, sources are not computes but only the rotation matrix.
This can save memory when working with big data. Defaults to False.
Returns
X_new : array-like, shape (n_samples, n_components)'

def _fit(self, X, compute_sources=False):

    fun_args = ({} if (self.fun_args is None) else self.fun_args)
    (whitening, unmixing, sources, X_mean, self.n_iter_) = fastica(X=X, n_components=self.n_components, algorithm=self.algorithm, whiten=self.whiten, fun=self.fun, fun_args=fun_args, max_iter=self.max_iter, tol=self.tol, w_init=self.w_init, random_state=self.random_state, return_X_mean=True, compute_sources=compute_sources, return_n_iter=True)
    if self.whiten:
        self.components_ = np.dot(unmixing, whitening)
        self.mean_ = X_mean
        self.whitening_ = whitening
    else:
        self.components_ = unmixing
    self.mixing_ = linalg.pinv(self.components_)
    if compute_sources:
        self.__sources = sources
    return sources
