File size: 668 Bytes
6491927
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import numpy as np
import joblib
from sklearn.linear_model import LinearRegression
from sklearn.preprocessing import PolynomialFeatures

# Sample data (can be replaced with your own)
X = np.array([[1], [2], [3], [4], [5]])
y = np.array([2.2, 4.8, 9.1, 16.5, 26.3])

# Polynomial transformation (degree=2)
poly = PolynomialFeatures(degree=2)
X_poly = poly.fit_transform(X)

# Train model
model = LinearRegression()
model.fit(X_poly, y)

# Save to the correct folder with capital 'M'
joblib.dump(model, 'Models/poly_model.pkl')
joblib.dump(poly, 'Models/poly_transform.pkl')

print("✅ Saved: Models/poly_model.pkl and Models/poly_transform.pkl")