[text] G

Viewer

  1. from sklearn.impute import SimpleImputer
  2.  
  3. # Impute missing values with the mean
  4. imputer = SimpleImputer(strategy='mean')
  5. X_imputed = imputer.fit_transform(X)
  6.  
  7. # Create and fit the model with imputed data
  8. model = LinearRegression()
  9. model.fit(X_imputed, y)

Editor

You can edit this paste and save as new:


File Description
  • G
  • Paste Code
  • 27 Apr-2024
  • 262 Bytes
You can Share it: