0Pricing
MLOps Academy · บทเรียน

ฝึกโมเดลและบันทึกเข้ารีจิสทรี

รันการฝึกและลงทะเบียนโมเดลที่ได้

ฝึกโมเดลและบันทึกเข้ารีจิสทรี เป็นบทเรียน MLOps Academy ฟรีบน CoddyKit นี่คือบทเรียนที่ 1 จากทั้งหมด 4 บทเรียน คุณสามารถอ่านบทเรียนทั้งหมดด้านล่างฟรี — จากนั้นลองปฏิบัติด้วยตัวคุณเองในเบราว์เซอร์พร้อมตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7 บทเรียนนี้เป็นส่วนหนึ่งของเส้นทางการเรียน MLOps Academy และความก้าวหน้าของคุณจะซิงค์ข้ามเว็บและแอป CoddyKit คอร์ส MLOps Academy มีบทเรียนทั้งหมด 4 บทเรียน

บางส่วนของบทเรียนนี้ยังไม่ได้รับการแปล และแสดงเป็นภาษาอังกฤษ

One Run, Fully Captured

This lesson ties training and the registry together. You train a model, then push it into the MLflow Model Registry so it becomes a versioned, reusable artifact. 🚀

Start a Tracking Run

Wrap your training in mlflow.start_run(). Everything you log inside that block belongs to one run, with its own id and timestamp.

import mlflow

with mlflow.start_run() as run:
    # train and log here
    print(run.info.run_id)

Train Your Model

Inside the run, fit your estimator like normal. The training code does not change just because MLflow is watching.

from sklearn.ensemble import RandomForestClassifier

model = RandomForestClassifier(n_estimators=100)
model.fit(X_train, y_train)

Log the Parameters

Record the choices you made with log_param. Months later, this is how you remember exactly which settings produced this model.

mlflow.log_param("n_estimators", 100)
mlflow.log_param("max_depth", None)

Log the Metrics

Capture how well it did with log_metric. Metrics are the numbers you will sort by when comparing runs later.

acc = model.score(X_test, y_test)
mlflow.log_metric("accuracy", acc)

Log the Model Artifact

Use mlflow.sklearn.log_model to save the fitted model into the run. MLflow stores the weights, flavor, and environment together.

mlflow.sklearn.log_model(
    sk_model=model,
    name="model",
)

Register While Logging

Pass registered_model_name and MLflow logs the model and registers a new version in one step. This is the cleanest path.

mlflow.sklearn.log_model(
    sk_model=model,
    name="model",
    registered_model_name="churn-classifier",
)

Register After the Fact

Already logged a model? Call register_model with the run URI to add it to the registry without retraining anything.

uri = "runs:/<run_id>/model"
mlflow.register_model(uri, "churn-classifier")

Versions Auto-Increment

Register the same name again and you get version 2, then 3, and so on. The registry keeps every version, never overwriting an old one.

Quick Check

You log a model under a name that already exists. What happens?

The Run, Confirmed

After the block exits, the run is marked FINISHED. Your params, metrics, and registered model version are now permanently linked.

Find It in the UI

Open the MLflow UI and your run appears under its experiment, with the new model version listed in the Models tab. Nothing is lost.

Recap: Train, Log, Register

You trained inside a run, logged params and metrics, saved the model, and registered a version. Train, log, register: that is the start of a real pipeline. ✅

คำถามที่พบบ่อย

บทเรียน “ฝึกโมเดลและบันทึกเข้ารีจิสทรี” ฟรีหรือไม่

ใช่ — ข้อความเต็มของ “ฝึกโมเดลและบันทึกเข้ารีจิสทรี” ฟรีให้อ่านที่นี่บนเว็บ เพื่อปฏิบัติแบบโต้ตอบ (ตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7) และปลดล็อคส่วนที่เหลือของคอร์ส MLOps Academy ให้อัปเกรดเป็น CoddyKit PRO คอร์ส MLOps Academy มีบทเรียนทั้งหมด 4 บทเรียน

คุณจะเรียนรู้อะไรในบทเรียน “ฝึกโมเดลและบันทึกเข้ารีจิสทรี”

รันการฝึกและลงทะเบียนโมเดลที่ได้ คุณปฏิบัติ MLOps Academy ด้วยโค้ดที่ใช้งานได้จริงที่คุณเรียกใช้โดยตรงในเบราว์เซอร์ และติวเตอร์ AI ตลอด 24/7 ตอบคำถามของคุณขณะที่คุณไปผ่านบทเรียน

คุณต้องมีประสบการณ์ก่อนที่จะเริ่มเรียน MLOps Academy หรือไม่

ไม่จำเป็นต้องมีประสบการณ์มาก่อน MLOps Academy บน CoddyKit ออกแบบมาสำหรับผู้เริ่มต้นไปจนถึงผู้เรียนขั้นสูง คุณสามารถเริ่มต้นที่นี่หรือเริ่มจากตัวแรกและเรียนด้วยความเร็วของคุณเอง นี่คือบทเรียนที่ 1 จากทั้งหมด 4 บทเรียน

บทเรียน “ฝึกโมเดลและบันทึกเข้ารีจิสทรี” ใช้เวลานานแค่ไหน

บทเรียน CoddyKit ส่วนใหญ่ใช้เวลาประมาณ 5–10 นาที แต่ละบทเรียนจึงสั้นและเป็นแบบโต้ตอบ คุณสามารถก้าวหน้าอย่างต่อเนื่องและกลับมาเรียนต่อจากตรงที่เพิ่งหยุดบนเว็บและแอปได้เลย

ฉันเขียนและรันโค้ดในบทเรียน MLOps Academy นี้ได้ไหม

ได้ บทเรียน MLOps Academy ทุกบทมีตัวแก้ไขโค้ดในตัว คุณจึงเขียนและรันโค้ดจริงได้เลยในเบราว์เซอร์ และได้รับข้อเสนอแนะจาก AI ในทันที — ไม่ต้องติดตั้งในเครื่องของคุณ

บทเรียนทั้งหมดในหลักสูตรนี้

  1. ฝึกโมเดลและบันทึกเข้ารีจิสทรี
  2. เลื่อนโมเดลที่ดีที่สุดขึ้น Production
  3. ให้บริการโมเดล Production
  4. ติดตามการเดินทางไปกลับของผลพยากรณ์
← กลับไปที่ MLOps Academy