撰寫有效的 ML 文件

Developing Machine Learning Models for Production

Sinan Ozdemir

Data Scientist, Entrepreneur, and Author

優良 ML 文件的組成

  • 資料來源
  • 資料綱要
  • 標註方法
  • 模型實驗與選擇
  • 訓練環境
  • 模型虛擬碼
Developing Machine Learning Models for Production

紀錄資料來源

讓我們能建立流程來評估資料品質。

也帶來其他好處:

  • 追蹤資料來源。
  • 評估並反覆改進資料品質。

來源

Developing Machine Learning Models for Production

資料綱要

描述資料組織的結構。

以關聯式資料庫綱要為例:

Database key Data type Data order
Person.name string nominal
Person.survey_score integer ordinal

綱要

Developing Machine Learning Models for Production

標註方法(分類)

紀錄我們如何標註應變數可提升:

  1. 訓練流程的「可重現性」。

  2. 透過標籤品質提升「模型可靠度」。

  3. 透過改進標籤提升「模型效能」。

選擇

標註方法會隨時間演進。

Developing Machine Learning Models for Production

模型虛擬碼

以視覺方式呈現建立機器學習模型的各步驟。

通常包含:

  • 特徵工程步驟。
  • 集成式 pipeline 的元件。
  • 模型的輸入與輸出範例。
Developing Machine Learning Models for Production

模型實驗與選擇

紀錄實驗流程與最佳模型的選擇,應包含:

  • 模型開發流程。
  • 納入考量的模型。
  • 使用的評估指標。
  • 各模型嘗試的超參數組合。

選擇

Developing Machine Learning Models for Production

訓練環境

要紀錄訓練環境,應包含:

  • 使用的套件與版本(例如 scikit-learn==1.1.3)。
  • 非決定性訓練所用的隨機種子(例如降維演算法)。

為什麼?

  • 能重現機器學習模型的結果。
  • 確保訓練與上線部署的一致性。
Developing Machine Learning Models for Production

一起來練習吧!

Developing Machine Learning Models for Production

Preparing Video For Download...