การบันทึกการทดลองบน MLFlow

Machine Learning แบบ End-to-End

Joshua Stapleton

Machine Learning Engineer

MLFlow

หากไม่มี MLflow...

  • การรันการทดลองไม่ถูกติดตามและไม่เป็นระเบียบ
  • การรันที่แตกต่างกันและเปรียบเทียบกันไม่ได้
  • การรันที่ทำซ้ำไม่ได้และสูญหาย

เมื่อใช้ MLflow...

  • ติดตามและจัดระเบียบการรันการทดลอง
  • เปรียบเทียบการรันที่เป็นมาตรฐานเดียวกัน
  • การรันที่ทำซ้ำได้
  • แชร์และดีพลอยโมเดล
Machine Learning แบบ End-to-End

การสร้างการทดลอง

mlflow.set_experiment()

  • กำหนดชื่อการทดลอง
  • จัดเตรียมพื้นที่ทำงานสำหรับการรันการทดลอง

 

การใช้งาน:

import mlflow

# Set an experiment name, which is a workspace for your runs
mlflow.set_experiment("Heart Disease Classification")
Machine Learning แบบ End-to-End

การรันการทดลอง

# 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 แบบ End-to-End

การดึงข้อมูลการทดลอง

 

mlflow.get_run(run_id)

  • เมตาดาต้าของการรันที่ระบุ

 

mlflow.search_runs()

  • คืนค่า DataFrame ของเมตริกสำหรับหลายการรัน

การใช้งาน:

# 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 แบบ End-to-End

MLFlow UI

 

แดชบอร์ดการทดลองของ MLFlow

 

หน้าการทดลองตัวอย่างของ MLFlow

Machine Learning แบบ End-to-End

MLFlow UI (ต่อ)

 

กราฟตัวอย่างแสดงการพัฒนาของเมตริก

 

ตัวอย่างการเปรียบเทียบเมตริกระหว่างการรัน

Machine Learning แบบ End-to-End

แหล่งข้อมูล MLflow

  • แนะนำ MLflow แนะนำ MLflow
  • เว็บไซต์ทางการของ MLflow เว็บไซต์ทางการของ MLflow
Machine Learning แบบ End-to-End

มาฝึกกันเถอะ!

Machine Learning แบบ End-to-End

Preparing Video For Download...