def fit(self, X, Y=None):
import sklearn.decomposition
self.preprocessor = sklearn.decomposition.FastICA(
n_components=self.n_components, algorithm=self.algorithm,
fun=self.fun, whiten=self.whiten, random_state=self.random_state
)
# Make the RuntimeWarning an Exception!
with warnings.catch_warnings():
warnings.filterwarnings("error")
try:
self.preprocessor.fit(X)
except ValueError as e:
if 'array must not contain infs or NaNs' in e.args[0]:
raise ValueError("Bug in scikit-learn: https://github.com/scikit-learn/scikit-learn/pull/2738")
else:
import traceback
traceback.format_exc()
raise ValueError()
return self
评论列表
文章目录