Model Pipeline - Logistic regression
Logistic regression is a simple model that helps us predict yes/no outcomes. It learns from data to find the best line that separates two groups.
Logistic regression is a simple model that helps us predict yes/no outcomes. It learns from data to find the best line that separates two groups.
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 with random weights, loss is high |
| 2 | 0.50 | 0.72 | Loss decreases, accuracy improves |
| 3 | 0.40 | 0.80 | Model learns better separation |
| 4 | 0.35 | 0.83 | Loss continues to decrease, accuracy rises |
| 5 | 0.30 | 0.86 | Model converges with good accuracy |
from sklearn.linear_model import LogisticRegression import numpy as np X = np.array([[0], [1], [2], [3]]) y = np.array([0, 0, 1, 1]) model = LogisticRegression() model.fit(X, y) pred = model.predict([[1.5]]) print(pred)
from sklearn.linear_model import LogisticRegression X = [[0], [1], [2], [3]] y = [0, 0, 1, 1] model = LogisticRegression() model.fit(X, y) pred = model.predict([1.5]) print(pred)
Pass the test and this pattern moves unknown