Download train_poly.py from deedrop1140/Neroml: direct link, hf CLI and curl.
- Browser
- Download file 668 Bytes
-
https://huggingface.co/deedrop1140/Neroml/resolve/main/train_poly.py
- Command line
-
hf download hf://deedrop1140/Neroml/train_poly.py
-
curl -L -o train_poly.py https://huggingface.co/deedrop1140/Neroml/resolve/main/train_poly.py
668 Bytes
| 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") | |