Model Pipeline - Polynomial regression
Polynomial regression fits a curved line to data by adding powers of the input as new features. This helps capture relationships that are not straight lines.
Polynomial regression fits a curved line to data by adding powers of the input as new features. This helps capture relationships that are not straight lines.
Loss
0.15 |****
0.08 |**
0.04 |*
0.025|*
0.02 |*
+------------
1 2 3 4 5 Epochs| Epoch | Loss ↓ | Accuracy ↑ | Observation |
|---|---|---|---|
| 1 | 0.15 | 0.70 | Initial fit with high error and moderate accuracy |
| 2 | 0.08 | 0.85 | Loss decreased, model capturing curve better |
| 3 | 0.04 | 0.92 | Further improvement, curve fits data well |
| 4 | 0.025 | 0.95 | Loss low, accuracy high, model converging |
| 5 | 0.02 | 0.96 | Minimal improvement, training stabilizing |
X_poly if X has shape (5, 1) and degree=2?
from sklearn.preprocessing import PolynomialFeatures poly = PolynomialFeatures(degree=2) X_poly = poly.fit_transform(X)
from sklearn.preprocessing import PolynomialFeatures from sklearn.linear_model import LinearRegression poly = PolynomialFeatures(degree=2) X_poly = poly.transform(X) model = LinearRegression() model.fit(X_poly, y)
Pass the test and this pattern moves unknown