Registrar experimentos en MLflow

Machine Learning de extremo a extremo

Joshua Stapleton

Machine Learning Engineer

MLflow

Sin MLflow...

  • Muchas ejecuciones sin seguimiento y desordenadas
  • Ejecuciones dispares o incomparables
  • Ejecuciones no reproducibles, perdidas

Con MLflow...

  • Ejecuciones con seguimiento y organizadas
  • Comparación entre ejecuciones estandarizadas
  • Ejecuciones reproducibles
  • Compartir y desplegar modelos
Machine Learning de extremo a extremo

Crear experimentos

mlflow.set_experiment()

  • Define el nombre del experimento
  • Crea el espacio de trabajo para las ejecuciones

 

Uso:

import mlflow

# Set an experiment name, which is a workspace for your runs
mlflow.set_experiment("Heart Disease Classification")
Machine Learning de extremo a extremo

Ejecutar experimentos

# Start a new run in this experiment
with mlflow.start_run():
    # Train a model, get the prediction accuracy
    logistic_model = LogisticRegression()

# Log parameters, eg: mlflow.log_param("n_estimators", logistic_model.n_estimators)
# Log metrics (accuracy in this case) mlflow.log_metric("accuracy", logistic_model.accuracy)
# Print out metrics print("Model accuracy: %.3f" % accuracy)
Model accuracy: 0.96
Machine Learning de extremo a extremo

Recuperar experimentos

 

mlflow.get_run(run_id)

  • Metadatos de una ejecución concreta

 

mlflow.search_runs()

  • Devuelve un DataFrame con métricas de varias ejecuciones

Uso:

# Fetch the run data and print params
run_data = mlflow.get_run(run_id)
print(run_data.data.params)
print(run_data.data.metrics)

# Search all runs in experiment
exp_id = run_data.info.experiment_id
runs_df = mlflow.search_runs(exp_id)
{'epochs': '20', 'accuracy': 0.95}
Machine Learning de extremo a extremo

Interfaz de MLflow

 

Panel de experimentos de MLflow

 

Página de ejemplo de experimento de MLflow

Machine Learning de extremo a extremo

Interfaz de MLflow (cont.)

 

Gráfico de ejemplo mostrando mejora de métricas

 

Comparación de métricas entre ejecuciones

Machine Learning de extremo a extremo

Recursos de MLflow

  • Introducción a MLflow Introducción a MLflow
  • Sitio web oficial de MLflow Sitio web oficial de MLflow
Machine Learning de extremo a extremo

¡Vamos a practicar!

Machine Learning de extremo a extremo

Preparing Video For Download...