0Pricing
MLOps Academy · 课时

阶段:摄取、准备、训练、评估

将训练拆分为清晰且可缓存的步骤

阶段:摄取、准备、训练、评估 是 CoddyKit 上的免费 MLOps Academy 课时。 这是第 1 节课,共 4 节。 你可以在下方免费阅读本课时的完整内容 — 然后在浏览器中使用内置代码编辑器和全天候 AI 导师进行实践。 这是 MLOps Academy 学习路径的一部分,你的进度在网页和 CoddyKit 应用中同步。 MLOps Academy 课程共包含 4 节课。

本课时的部分内容尚未翻译,以英文显示。

From One Big Script to Stages

A single train.py that does everything is hard to reuse and slow to debug. Splitting it into stages makes each step clear and independently runnable. 🧩

The Four Classic Stages

Most training pipelines follow the same shape: ingest, prep, train, eval. Each stage takes inputs and produces outputs the next one reads.

Stage 1: Ingest

The ingest stage pulls raw data from its source, like a database or bucket, and writes it to a known local path. Nothing is cleaned yet.

import pandas as pd
df = pd.read_csv("s3://bucket/raw.csv")
df.to_parquet("data/raw.parquet")

Stage 2: Prep

The prep stage cleans and transforms raw data into model-ready features. It handles missing values, encoding, and splitting into train and test sets.

Stage 3: Train

The train stage reads prepared features and fits the model, then saves the fitted artifact to disk for the next stage to score.

model.fit(X_train, y_train)
joblib.dump(model, "models/model.pkl")

Stage 4: Eval

The eval stage loads the saved model, scores it on the held-out test set, and writes metrics like accuracy to a file you can track.

score = model.score(X_test, y_test)
json.dump({"accuracy": score}, open("metrics.json", "w"))

Stages Pass Files, Not Variables

Stages talk to each other through files on disk, not in-memory variables. That decoupling is what lets you re-run one stage without the others.

Why Stages Are Cacheable

Because each stage has fixed inputs and outputs, a tool can cache its result. If the inputs did not change, the stage is skipped entirely.

Each Stage Is Its Own Script

Give every stage one small script with a clear job. ingest.py, prep.py, train.py, eval.py read inputs and write outputs, nothing more.

Stages Form a DAG

Stages connect into a DAG, a directed graph where each step depends on the ones before it. Eval depends on train, train on prep, prep on ingest.

Clear Stages Make Debugging Easy

When a run fails, distinct stages tell you exactly where it broke. You can re-run just the failed stage instead of the whole pipeline.

Quick Check

Let us check how stages communicate.

Recap: Ingest, Prep, Train, Eval

You learned to split training into four cacheable stages that pass data through files. Clear stages mean faster reruns and far easier debugging. 🚀

常见问题解答

「阶段:摄取、准备、训练、评估」课时是免费的吗?

是的 — 「阶段:摄取、准备、训练、评估」的完整文本可在网页上免费阅读。要进行交互式练习(内置代码编辑器和全天候 AI 导师)并解锁 MLOps Academy 课程的其余内容,请升级到 CoddyKit PRO。 MLOps Academy 课程共包含 4 节课。

「阶段:摄取、准备、训练、评估」这节课中我会学到什么?

将训练拆分为清晰且可缓存的步骤 你通过在浏览器中直接运行的动手代码来练习 MLOps Academy,全天候 AI 导师会在你学习这节课的过程中回答你的问题。

学习 MLOps Academy 需要有经验吗?

无需任何先前经验。CoddyKit 上的 MLOps Academy 课程适合初学者到高级学习者,你可以从这里开始或从头开始,按照自己的节奏学习。 这是第 1 节课,共 4 节。

「阶段:摄取、准备、训练、评估」课时需要多长时间?

大多数 CoddyKit 课程大约需要 5–10 分钟。每节课都很精短且互动,所以你能稳步进步,并在网页和应用中从离开的地方继续。

我能在这节 MLOps Academy 课中编写并运行代码吗?

能。每节 MLOps Academy 课都包含内置代码编辑器,你可以在浏览器中直接编写并运行真实代码,并获得即时 AI 反馈 — 无需本地设置。

此课程中的所有课时

  1. 阶段:摄取、准备、训练、评估
  2. 使用 DVC 阶段定义流程
  3. 缓存并跳过未改变的步骤
  4. 使用 params.yaml 参数化运行
← 返回 MLOps Academy