Slide 10
Slide 10 text
Confidential
● MLflow is an open source Python framework
for creating and managing machine learning
models.
● Deploy it as a web application. Interact via
Python API (see code example) and Web UI.
● Keeps track of model executable files,
parameters, model versions, performance
metrics and data visualization files.
Example #2 - Organized Machine Learning with MLflow
# Get training data
train_x, train_y, test_x, test_y = get_train_data()
with mlflow.start_run():
# Train a model
model = ElasticNet(alpha=0.5, l1_ratio=0.5)
model.fit(train_x, train_y)
# Evaluate performance
y_pred = model.predict(test_x)
(rmse, mae, r2) = eval_metrics(test_y, y_pred)
# Record model parameters
mlflow.log_param("alpha", alpha)
mlflow.log_param("l1_ratio", l1_ratio)
# Record performance metrics
mlflow.log_metric("rmse", rmse)
mlflow.log_metric("r2", r2)
mlflow.log_metric("mae", mae)
# Save model executable file
mlflow.sklearn.log_model(
model,
artifact_path="model",
registered_model_name="MyFirstModel"
)
Image: Databricks
Comparing model
performance via the UI
Training and saving a
new model to MLflow