Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3bdfdeb

Browse files
committed
Reuse 'FastICA' class validations in 'fastica' funcation
1 parent 0c03734 commit 3bdfdeb

File tree

1 file changed

+5
-16
lines changed

1 file changed

+5
-16
lines changed

sklearn/decomposition/_fastica.py

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -156,21 +156,6 @@ def _cube(x, fun_args):
156156

157157
@validate_params(
158158
{
159-
"X": ["array-like"],
160-
"n_components": [Interval(Integral, 1, None, closed="left"), None],
161-
"algorithm": [StrOptions({"parallel", "deflation"})],
162-
"whiten": [
163-
Hidden(StrOptions({"warn"})),
164-
StrOptions({"arbitrary-variance", "unit-variance"}),
165-
"boolean",
166-
],
167-
"fun": [StrOptions({"logcosh", "exp", "cube"}), callable],
168-
"fun_args": [dict, None],
169-
"max_iter": [Interval(Integral, 1, None, closed="left")],
170-
"tol": [Interval(Real, 0.0, None, closed="left")],
171-
"w_init": ["array-like", None],
172-
"whiten_solver": [StrOptions({"eigh", "svd"})],
173-
"random_state": ["random_state"],
174159
"return_X_mean": ["boolean"],
175160
"compute_sources": ["boolean"],
176161
"return_n_iter": ["boolean"],
@@ -341,7 +326,11 @@ def my_g(x):
341326
whiten_solver=whiten_solver,
342327
random_state=random_state,
343328
)
344-
S = est._fit_transform(X, compute_sources=compute_sources)
329+
if compute_sources:
330+
S = est.fit_transform(X)
331+
else:
332+
est.fit(X)
333+
S = None
345334

346335
if est._whiten in ["unit-variance", "arbitrary-variance"]:
347336
K = est.whitening_

0 commit comments

Comments
 (0)