lale.lib.sklearn.simple_imputer module

class lale.lib.sklearn.simple_imputer.SimpleImputer(*, missing_values=nan, strategy='mean', fill_value=None, copy=True, add_indicator=False, keep_empty_features=False)

Bases: PlannedIndividualOp

Simple imputer transformer from scikit-learn for completing missing values.

This documentation is auto-generated from JSON schemas.

Parameters
  • missing_values (union type, not for optimizer, default nan) –

    The placeholder for the missing values.

    • float

    • or string

    • or nan

    • or None

  • strategy (union type, default 'mean') –

    The imputation strategy.

    • ’constant’, not for optimizer

    • or ‘mean’, ‘median’, or ‘most_frequent’

  • fill_value (union type, not for optimizer, default None) –

    When strategy == “constant”, fill_value is used to replace all occurrences of missing_values

    • float

    • or string

    • or None

  • copy (boolean, not for optimizer, default True) – If True, a copy of X will be created.

  • add_indicator (boolean, not for optimizer, default False) – If True, a MissingIndicator transform will stack onto output of the imputer’s transform.

  • keep_empty_features (boolean, optional, not for optimizer, default False) – If True, features that consist exclusively of missing values when fit is called are returned in results when transform is called. The imputed value is always 0 except when strategy=”constant” in which case fill_value will be used instead.

fit(X, y=None, **fit_params)

Train the operator.

Note: The fit method is not available until this operator is trainable.

Once this method is available, it will have the following signature:

Parameters
  • X (array) –

    Input data, where n_samples is the number of samples and n_features is the number of features.

    • items : array

      • items : union type

        • float

        • or string

  • y (any type, optional) –

transform(X, y=None)

Transform the data.

Note: The transform method is not available until this operator is trained.

Once this method is available, it will have the following signature:

Parameters

X (array) –

The input data to complete.

  • items : array

    • items : union type

      • float

      • or string

Returns

result – The input data to complete.

  • items : array

    • items : union type

      • float

      • or string

Return type

array