Skip to content
Snippets Groups Projects
Commit 33138a30 authored by mikeleo03's avatar mikeleo03
Browse files

[Feat] Model auto-deploy based on updates

parent 0627ffa8
Branches
No related merge requests found
......@@ -33,7 +33,7 @@ def model_train(x_train, y_train):
def model_predict(x_test):
# Load the model
model_uri = "models:/XGB-Model-New/latest"
model_uri = "models:/XGB-Model/latest"
loaded_model = mlflow.xgboost.load_model(model_uri)
# Predict
......@@ -42,7 +42,7 @@ def model_predict(x_test):
return y_pred
def model_evaluation(x_test,y_test):
def model_evaluation(x_test, y_test):
y_pred = model_predict(x_test)
# Classification Report
......@@ -53,7 +53,7 @@ def model_evaluation(x_test,y_test):
def model_tracking(model_name, params, report):
# Set experiment
mlflow.set_experiment('MLFlow Simulation 2')
mlflow.set_experiment('MLFlow Customer Churn')
mlflow.set_tracking_uri('http://127.0.0.1:5000/')
with mlflow.start_run(run_name=model_name):
......@@ -86,7 +86,7 @@ def model_tracking(model_name, params, report):
def model_registration():
model_name = 'XGB-Model-New'
model_name = 'XGB-Model'
run_id = 'd03626566e3240e6942ec8f5a43c2333'
model_uri = f'runs:/{run_id}/model_name'
......@@ -97,7 +97,7 @@ def model_registration():
def model_prod(model_name):
current_model_uri = f"models:/{model_name}@challenger"
production_model_name = "customer-churn-prod-final"
production_model_name = "customer-churn-prod"
client = mlflow.MlflowClient()
client.copy_model_version(src_model_uri=current_model_uri, dst_name=production_model_name)
......
This diff is collapsed.
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment