hyperimpute.plugins.imputers.plugin_mice module
- class MicePlugin(n_imputations: int = 1, max_iter: int = 100, tol: float = 0.001, initial_strategy: int = 0, imputation_order: int = 0, random_state: int = 0)
Bases:
ImputerPlugin
Imputation plugin for completing missing values using the Multivariate Iterative chained equations and multiple imputations.
- Method:
Multivariate Iterative chained equations(MICE) methods model each feature with missing values as a function of other features in a round-robin fashion. For each step of the round-robin imputation, we use a BayesianRidge estimator, which does a regularized linear regression. The class sklearn.impute.IterativeImputer is able to generate multiple imputations of the same incomplete dataset. We can then learn a regression or classification model on different imputations of the same dataset. Setting sample_posterior=True for the IterativeImputer will randomly draw values to fill each missing value from the Gaussian posterior of the predictions. If each IterativeImputer uses a different random_state, this results in multiple imputations, each of which can be used to train a predictive model. The final result is the average of all the n_imputation estimates.
- Parameters:
n_imputations – int, default=5i number of multiple imputations to perform.
max_iter – int, default=500 maximum number of imputation rounds to perform.
random_state – int, default set to the current time. seed of the pseudo random number generator to use.
Example
>>> import numpy as np >>> from hyperimpute.plugins.imputers import Imputers >>> plugin = Imputers().get("mice") >>> plugin.fit_transform([[1, 1, 1, 1], [np.nan, np.nan, np.nan, np.nan], [1, 2, 2, 1], [2, 2, 2, 2]])
- _abc_impl = <_abc_data object>
- _fit(**kwargs: Any) Any
- _transform(**kwargs: Any) Any
- imputation_order_vals = ['ascending', 'descending', 'roman', 'arabic', 'random']
- initial_strategy_vals = ['mean', 'median', 'most_frequent', 'constant']
- module_relative_path: Optional[Path]
- static name() str
- plugin
alias of
MicePlugin