Created
October 18, 2023 03:16
-
-
Save saimadhu-polamuri/8001d710fd7ea00651228c1d2ec6e693 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn.experimental import enable_iterative_imputer | |
from sklearn.impute import IterativeImputer | |
from sklearn.datasets import load_diabetes | |
diabetes = load_diabetes() | |
X, y = diabetes.data, diabetes.target | |
# Introduce some missing values in X | |
missing_mask = np.random.rand(*X.shape) < 0.1 | |
X_missing = X.copy() | |
X_missing[missing_mask] = np.nan | |
imputer = IterativeImputer() | |
X_imputed = imputer.fit_transform(X_missing) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment