Model Pipeline - ML workflow (collect, prepare, train, evaluate, deploy)
This ML workflow shows how data is collected, prepared, used to train a model, evaluated for accuracy, and finally deployed for making predictions in real life.
This ML workflow shows how data is collected, prepared, used to train a model, evaluated for accuracy, and finally deployed for making predictions in real life.
Loss
0.9 |*
0.7 | **
0.5 | ***
0.3 | ****
0.1 | *****
1 2 3 4 5 Epochs
| Epoch | Loss ↓ | Accuracy ↑ | Observation |
|---|---|---|---|
| 1 | 0.85 | 0.60 | Model starts learning, loss high, accuracy low |
| 2 | 0.60 | 0.70 | Loss decreases, accuracy improves |
| 3 | 0.40 | 0.78 | Model learns important patterns |
| 4 | 0.25 | 0.83 | Loss continues to drop, accuracy rises |
| 5 | 0.15 | 0.85 | Model converges with good accuracy |
from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
from sklearn.tree import DecisionTreeClassifier
from sklearn.metrics import accuracy_score
iris = load_iris()
X_train, X_test, y_train, y_test = train_test_split(iris.data, iris.target, test_size=0.3, random_state=42)
model = DecisionTreeClassifier()
model.fit(X_train, y_train)
predictions = model.predict(X_test)
accuracy = accuracy_score(y_test, predictions)
print(f"Accuracy: {accuracy:.2f}")from sklearn.linear_model import LogisticRegression model = LogisticRegression() model.fit(X_train, y_train) print(model.predict(X_test))Assuming
X_train, y_train, and X_test are defined but you forgot to prepare data properly.Pass the test and this pattern moves unknown