diff --git a/doc/modules/impute.rst b/doc/modules/impute.rst index 1d1f6e926e8f8..45523d74fe9b8 100644 --- a/doc/modules/impute.rst +++ b/doc/modules/impute.rst @@ -106,16 +106,17 @@ round are returned. >>> import numpy as np >>> from sklearn.impute import IterativeImputer >>> imp = IterativeImputer(n_iter=10, random_state=0) - >>> imp.fit([[1, 2], [np.nan, 3], [7, np.nan]]) # doctest: +NORMALIZE_WHITESPACE + >>> imp.fit([[1, 2], [3, 6], [4, 8], [np.nan, 3], [7, np.nan]]) # doctest: +NORMALIZE_WHITESPACE IterativeImputer(imputation_order='ascending', initial_strategy='mean', max_value=None, min_value=None, missing_values=nan, n_iter=10, n_nearest_features=None, predictor=None, random_state=0, sample_posterior=False, verbose=False) >>> X_test = [[np.nan, 2], [6, np.nan], [np.nan, 6]] + >>> # the model learns that the second feature is double the first >>> print(np.round(imp.transform(X_test))) [[ 1. 2.] - [ 6. 3.] - [26. 6.]] + [ 6. 12.] + [ 3. 6.]] Both :class:`SimpleImputer` and :class:`IterativeImputer` can be used in a Pipeline as a way to build a composite estimator that supports imputation.