8000 DOC Adds example for preprocessing.FunctionTransformer (#15192) · scikit-learn/scikit-learn@5271695 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5271695

Browse files
Andrea Maldonadothomasjpfan
Andrea Maldonado
authored andcommitted
DOC Adds example for preprocessing.FunctionTransformer (#15192)
1 parent a5f32da commit 5271695

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

sklearn/preprocessing/_function_transformer.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,15 @@ class FunctionTransformer(TransformerMixin, BaseEstimator):
6969
inv_kw_args : dict, optional
7070
Dictionary of additional keyword arguments to pass to inverse_func.
7171
72+
Examples
73+
--------
74+
>>> import numpy as np
75+
>>> from sklearn.preprocessing import FunctionTransformer
76+
>>> transformer = FunctionTransformer(np.log1p)
77+
>>> X = np.array([[0, 1], [2, 3]])
78+
>>> transformer.transform(X)
79+
array([[0. , 0.6931...],
80+
[1.0986..., 1.3862...]])
7281
"""
7382
def __init__(self, func=None, inverse_func=None, validate=False,
7483
accept_sparse=False, check_inverse=True, kw_args=None,

0 commit comments

Comments
 (0)
0