Model Pipeline - Handling missing values
This pipeline shows how missing values in data are handled before training a machine learning model. It fills missing spots with average values so the model can learn better.
This pipeline shows how missing values in data are handled before training a machine learning model. It fills missing spots with average values so the model can learn better.
Loss
0.7 | *
0.6 | **
0.5 | ***
0.4 | ****
0.3 | *****
1 2 3 4 5 Epochs| Epoch | Loss ↓ | Accuracy ↑ | Observation |
|---|---|---|---|
| 1 | 0.65 | 0.60 | Model starts learning, loss high, accuracy low |
| 2 | 0.50 | 0.72 | Loss decreases, accuracy improves |
| 3 | 0.40 | 0.80 | Model learns better patterns |
| 4 | 0.35 | 0.83 | Loss continues to decrease, accuracy rises |
| 5 | 0.32 | 0.85 | Model converges with good accuracy |
print(X_imputed)?
import numpy as np from sklearn.impute import SimpleImputer X = np.array([[1, 2], [np.nan, 3], [7, np.nan]]) imputer = SimpleImputer(strategy='mean') imputer.fit(X) X_imputed = imputer.transform(X) print(X_imputed)
from sklearn.impute import SimpleImputer X_train = [[1, 2], [None, 3], [7, None]] imputer = SimpleImputer(strategy='median') imputer.transform(X_train)
Pass the test and this pattern moves unknown