glassbox.cleaner.imputers¶
SimpleImputer — replaces missing values using mean, median, mode, or a constant.
ImputationStrategy
¶
Bases: Enum
Strategies available for imputing missing values.
SimpleImputer
¶
Bases: BaseTransformer
Replaces missing values using a specified statistical strategy.
Notes
This imputer supports basic strategies like mean, median, mode, or a constant value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
strategy
|
ImputationStrategy
|
The strategy used for missing value imputation. |
ImputationStrategy.MEAN
|
constant_value
|
Union[float, str, None]
|
The value to use when strategy is CONSTANT. |
0.0
|
Source code in glassbox/cleaner/imputers.py
fit
¶
Learn the imputation values from the training data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X
|
ndarray
|
Input array of shape (n_samples, n_features). |
required |
Returns:
| Type | Description |
|---|---|
Self
|
Fitted imputer instance. |
Source code in glassbox/cleaner/imputers.py
transform
¶
Impute missing values in the given dataset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X
|
ndarray
|
Input array of shape (n_samples, n_features). |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Transformed array with missing values imputed. |