Spaces:
Sleeping
Sleeping
Update train_model.py
Browse files- train_model.py +7 -0
train_model.py
CHANGED
|
@@ -5,6 +5,13 @@ from sklearn.metrics import mean_absolute_error, mean_absolute_percentage_error,
|
|
| 5 |
import joblib
|
| 6 |
|
| 7 |
def train_and_save_model(data_path='palm_oil.xlsx', output_path='static/model/model.pkl'):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
# Load data
|
| 9 |
df = pd.read_excel(data_path)
|
| 10 |
df['date'] = pd.to_datetime(df['date'])
|
|
|
|
| 5 |
import joblib
|
| 6 |
|
| 7 |
def train_and_save_model(data_path='palm_oil.xlsx', output_path='static/model/model.pkl'):
|
| 8 |
+
"""
|
| 9 |
+
Train a linear regression model on palm oil price data and save it.
|
| 10 |
+
|
| 11 |
+
Args:
|
| 12 |
+
data_path (str): Path to the Excel file containing palm oil data
|
| 13 |
+
output_path (str): Path to save the trained model
|
| 14 |
+
"""
|
| 15 |
# Load data
|
| 16 |
df = pd.read_excel(data_path)
|
| 17 |
df['date'] = pd.to_datetime(df['date'])
|