Model Pipeline - scikit-learn Pipeline
The scikit-learn Pipeline helps chain data steps and model training into one simple flow. It makes sure data is prepared the same way every time before training or predicting.
The scikit-learn Pipeline helps chain data steps and model training into one simple flow. It makes sure data is prepared the same way every time before training or predicting.
Loss
0.7 |****
0.6 |***
0.5 |**
0.4 |**
0.3 |*
0.2 |*
0.1 |
+-----
1 2 3 4 5 Epochs| Epoch | Loss ↓ | Accuracy ↑ | Observation |
|---|---|---|---|
| 1 | 0.65 | 0.7 | Starting training with moderate loss and accuracy |
| 2 | 0.45 | 0.82 | Loss decreased, accuracy improved |
| 3 | 0.3 | 0.9 | Model learning well, loss dropping |
| 4 | 0.22 | 0.93 | Further improvement, nearing convergence |
| 5 | 0.18 | 0.95 | Training converged with low loss and high accuracy |
Pipeline in scikit-learn?print(y_pred) output?from sklearn.pipeline import Pipeline
from sklearn.preprocessing import StandardScaler
from sklearn.linear_model import LogisticRegression
import numpy as np
X_train = np.array([[1, 2], [2, 3], [3, 4]])
y_train = np.array([0, 1, 0])
X_test = np.array([[1, 2], [4, 5]])
pipe = Pipeline([
('scaler', StandardScaler()),
('model', LogisticRegression())
])
pipe.fit(X_train, y_train)
y_pred = pipe.predict(X_test)
print(y_pred)from sklearn.pipeline import Pipeline
from sklearn.preprocessing import StandardScaler
from sklearn.linear_model import LogisticRegression
pipe = Pipeline([
('scaler', StandardScaler),
('model', LogisticRegression())
])
pipe.fit(X_train, y_train)Pass the test and this pattern moves unknown