โมดูล MLflow projects
นอกจากการรันผ่าน command-line แล้ว MLflow Projects ยังสามารถรันด้วย Python ผ่านโมดูล mlflow projects ได้อีกด้วย
ในแบบฝึกหัดนี้ จะได้รัน MLflow Project โดยใช้โมดูล projects เพื่อเทรนโมเดลสำหรับ Project "Insurance" โดยกำหนด entry point จากไฟล์ MLproject เพื่อรันโค้ดสำหรับการเทรน และกำหนดชื่อ experiment เป็น "Insurance" เพื่อให้โมเดลถูกบันทึกลงใน experiment ที่ถูกต้องใน MLflow Tracking
สามารถอ่านเนื้อหาของไฟล์ MLproject ได้โดยรัน print(MLproject) ใน IPython shell
แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร
MLflow เบื้องต้น
คำแนะนำการฝึกหัด
- เรียกใช้ฟังก์ชัน
run()จากโมดูลmlflow projects - กำหนด URI สำหรับไฟล์
MLprojectให้ชี้ไปที่ไดเรกทอรีทำงานปัจจุบัน - กำหนด entry point เป็น
"main"ตามที่ระบุไว้ในไฟล์MLproject - กำหนดชื่อ experiment เป็น
"Insurance"
แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ
ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์
import mlflow
# Set the run function from the MLflow Projects module
____.____.____(
# Set the URI as the current working directory
____='____',
# Set the entry point to main
____='____',
# Set the experiment name as Insurance
____='____',
env_manager="local",
synchronous=True,
)