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

Skip to content

Commit bf8b91f

Browse files
larsmansamueller
authored andcommitted
DOC expand FunctionTransform docstring
1 parent ba44e7b commit bf8b91f

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

sklearn/preprocessing/function_transformer.py

+13-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@ def _identity(X):
1111
class FunctionTransformer(BaseEstimator, TransformerMixin):
1212
"""Constructs a transformer from an arbitrary callable.
1313
14+
A FunctionTransformer forwards its X (and optionally y) arguments to a
15+
user-defined function or function object and returns the result of this
16+
function. This is useful for stateless transformations such as taking the
17+
log of frequencies, doing custom scaling, etc.
18+
19+
A FunctionTransformer will not do any checks on its function's output.
20+
1421
Note: If a lambda is used as the function, then the resulting
1522
transformer will not be pickleable.
1623
@@ -24,9 +31,14 @@ class FunctionTransformer(BaseEstimator, TransformerMixin):
2431
validate : bool, optional default=True
2532
Indicate that the input X array should be checked before calling
2633
func. If validate is false, there will be no input validation.
34+
If it is true, then X will be converted to a 2-dimensional NumPy
35+
array or sparse matrix. If this conversion is not possible or X
36+
contains NaN or infinity, an exception is raised.
2737
2838
accept_sparse : boolean, optional
29-
Indicate that func accepts a sparse matrix as input.
39+
Indicate that func accepts a sparse matrix as input. If validate is
40+
False, this has no effect. Otherwise, if accept_sparse is false,
41+
sparse matrix inputs will cause an exception to be raised.
3042
3143
pass_y: bool, optional default=False
3244
Indicate that transform should forward the y argument to the

0 commit comments

Comments
 (0)