평가: DVC의 지표와 플롯

DVC로 배우는 데이터 버저닝 입문

Ravi Bhadauria

Machine Learning Engineer

지표: dvc.yaml 변경 사항

  • 실험 간 지표 추적을 위해 DVC YAML 구성
  • outs에서 변경
stages:
  train_and_evaluate:
    outs:
    - metrics.json
    - plots.png

$$ $$

  • metrics로 변경
stages:
  train_and_evaluate:
    outs:
    - plots.png
    metrics:
      - metrics.json:
        cache: false
DVC로 배우는 데이터 버저닝 입문

DVC 지표 출력

$ dvc metrics show
Path          accuracy    f1_score    precision    recall             
metrics.json  0.947       0.8656      0.988        0.7702
DVC로 배우는 데이터 버저닝 입문

실행 간 지표 비교

  • 하이퍼파라미터를 변경하고 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
DVC로 배우는 데이터 버저닝 입문

플롯: dvc.yaml 변경 사항

stages:
  train_and_evaluate:
    ...
    plots:
    - predictions.csv: # 예측이 담긴 파일명
        template: confusion # 플롯 스타일

x: predicted_label # CSV의 X축 열 이름 y: true_label # CSV의 Y축 열 이름 x_label: 'Predicted label' y_label: 'True label' title: Confusion matrix
cache: false # Git에 저장
1 https://dvc.org/doc/user-guide/experiment-management/visualizing-plots#plot-templates-data-series-only
DVC로 배우는 데이터 버저닝 입문

DVC 플롯을 파일로 출력

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

DVC로 생성된 혼동 행렬 플롯

DVC로 배우는 데이터 버저닝 입문

DVC 플롯 비교

# predictions.csv 플롯을 브랜치 main과 비교
$ dvc plots diff --target predictions.csv <branch name or commit SHA>

DVC로 생성된 혼동 행렬 비교 플롯

DVC로 배우는 데이터 버저닝 입문

연습해 봅시다!

DVC로 배우는 데이터 버저닝 입문

Preparing Video For Download...