Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Petter Olsson committed Nov 13, 2024
1 parent bcc361e commit 96b77ac
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions scripts/.ipynb_checkpoints/sklearn_model_train-checkpoint.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import pandas as pd
import numpy as np
import scipy.linalg
import matplotlib.pyplot as plt
import seaborn as sns
import sklearn
Expand All @@ -14,6 +15,9 @@
from mlflow.store.artifact.runs_artifact_repo import RunsArtifactRepository
from mlflow import MlflowClient
from datetime import datetime

# Patch scipy.linalg to use np.linalg.pinv instead of pinv2
scipy.linalg.pinv2 = np.linalg.pinv

#Read in data
path = str('/mnt/data/{}/WineQualityData.csv'.format(os.environ.get('DOMINO_PROJECT_NAME')))
Expand Down Expand Up @@ -45,7 +49,6 @@
#mlflow.set_experiment(experiment_name=os.environ.get('DOMINO_PROJECT_NAME') + " " + os.environ.get('DOMINO_STARTING_USERNAME'))
mlflow.set_experiment(experiment_name=os.environ.get('DOMINO_PROJECT_NAME') + " " + os.environ.get('DOMINO_STARTING_USERNAME') + " " + os.environ.get('MLFLOW_NAME'))


with mlflow.start_run():
# Set MLFlow tag to differenciate the model approaches
mlflow.set_tag("Model_Type", "sklearn")
Expand All @@ -55,7 +58,10 @@

#initiate and fit Gradient Boosted Classifier
print('Training model...')
gbr = GradientBoostingRegressor(loss='squared_error',learning_rate = 0.15, n_estimators=75, criterion = 'squared_error')
#gbr = GradientBoostingRegressor(loss='squared_error',learning_rate = 0.15, n_estimators=75, criterion = 'squared_error')
#gbr = GradientBoostingRegressor(loss='ls', learning_rate=0.15, n_estimators=75, criterion='squared_error')
gbr = GradientBoostingRegressor(loss='ls', learning_rate=0.15, n_estimators=75, criterion='friedman_mse')

gbr.fit(X_train,y_train)

#Predict test set
Expand Down
2 changes: 1 addition & 1 deletion scripts/sklearn_model_train.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
print('Training model...')
#gbr = GradientBoostingRegressor(loss='squared_error',learning_rate = 0.15, n_estimators=75, criterion = 'squared_error')
#gbr = GradientBoostingRegressor(loss='ls', learning_rate=0.15, n_estimators=75, criterion='squared_error')
gbr = GradientBoostingRegressor(loss='ls', learning_rate=0.15, n_estimators=75, criterion='mse')
gbr = GradientBoostingRegressor(loss='ls', learning_rate=0.15, n_estimators=75, criterion='friedman_mse')

gbr.fit(X_train,y_train)

Expand Down

0 comments on commit 96b77ac

Please sign in to comment.