Đánh giá: Chỉ số và biểu đồ trong DVC

Nhập môn Quản lý Phiên bản Dữ liệu với DVC

Ravi Bhadauria

Machine Learning Engineer

Metrics: thay đổi trong dvc.yaml

  • Cấu hình tệp YAML của DVC để theo dõi metrics giữa các thử nghiệm
  • Đổi từ outs
stages:
  train_and_evaluate:
    outs:
    - metrics.json
    - plots.png

$$ $$

  • Sang metrics
stages:
  train_and_evaluate:
    outs:
    - plots.png
    metrics:
      - metrics.json:
        cache: false
Nhập môn Quản lý Phiên bản Dữ liệu với DVC

In metrics của DVC

$ dvc metrics show
Path          accuracy    f1_score    precision    recall             
metrics.json  0.947       0.8656      0.988        0.7702
Nhập môn Quản lý Phiên bản Dữ liệu với DVC

So sánh metrics giữa các lần chạy

  • Thay đổi một siêu tham số và chạy lại dvc repro
$ dvc metrics diff
Path          Metric     HEAD    workspace    Change                  
metrics.json  accuracy   0.947   0.9995       0.0525
metrics.json  f1_score   0.8656  0.9989       0.1333
metrics.json  precision  0.988   0.9993       0.0113
metrics.json  recall     0.7702  0.9986       0.2284
Nhập môn Quản lý Phiên bản Dữ liệu với DVC

Plots: thay đổi trong dvc.yaml

stages:
  train_and_evaluate:
    ...
    plots:
    - predictions.csv: # Tên tệp chứa dự đoán
        template: confusion # Kiểu biểu đồ

x: predicted_label # Cột trục X trong tệp csv y: true_label # Cột trục Y trong tệp csv x_label: 'Predicted label' y_label: 'True label' title: Confusion matrix
cache: false # Lưu trong Git
1 https://dvc.org/doc/user-guide/experiment-management/visualizing-plots#plot-templates-data-series-only
Nhập môn Quản lý Phiên bản Dữ liệu với DVC

Xuất biểu đồ DVC ra tệp

$ dvc plots show predictions.csv
file:///path/to/index.html

Biểu đồ ma trận nhầm lẫn do DVC tạo

Nhập môn Quản lý Phiên bản Dữ liệu với DVC

So sánh biểu đồ DVC

# so sánh biểu đồ trong predictions.csv với nhánh main
$ dvc plots diff --target predictions.csv <branch name or commit SHA>

Biểu đồ so sánh ma trận nhầm lẫn do DVC tạo

Nhập môn Quản lý Phiên bản Dữ liệu với DVC

Hãy luyện tập!

Nhập môn Quản lý Phiên bản Dữ liệu với DVC

Preparing Video For Download...