Download train_model.py from deedrop1140/Neroml: direct link, hf CLI and curl.
- Browser
- Download file 558 Bytes
-
https://huggingface.co/deedrop1140/Neroml/resolve/main/train_model.py
- Command line
-
hf download hf://deedrop1140/Neroml/train_model.py
-
curl -L -o train_model.py https://huggingface.co/deedrop1140/Neroml/resolve/main/train_model.py
558 Bytes
| import numpy as np | |
| from sklearn.linear_model import LinearRegression | |
| import joblib | |
| model = joblib.load('C:\\Users\\deeku\\OneDrive\\Desktop\\neroml\\supervised_model.pkl') | |
| # Training data | |
| hours_studied = np.array([1, 2, 3, 4, 5]).reshape(-1, 1) | |
| scores = np.array([35, 45, 55, 65, 75]) | |
| # Create and train the model | |
| model = LinearRegression() | |
| model.fit(hours_studied, scores) | |
| # Print the model parameters | |
| print(f"Slope (m): {model.coef_[0]}") | |
| print(f"Intercept (b): {model.intercept_}") | |
| # Save the model | |
| joblib.dump(model, 'supervised_model.pkl') |