메인 콘텐츠로 건너뛰기
W&B의 맞춤형 차트는 wandb.plot 네임스페이스의 함수 모음을 통해 프로그래밍 방식으로 사용할 수 있습니다. 이 함수들은 W&B 프로젝트 대시보드에서 대화형 시각화를 생성하며, 혼동 행렬, ROC 곡선, 분포 플롯과 같은 일반적인 ML 시각화를 지원합니다.

사용 가능한 차트 함수

함수설명
confusion_matrix()분류 성능을 시각화하는 혼동 행렬을 생성합니다.
roc_curve()이진 및 다중 클래스 분류기를 위한 ROC 곡선을 생성합니다.
pr_curve()분류기 평가를 위한 정밀도-재현율 곡선을 생성합니다.
line()표 형식 데이터에서 선 차트를 생성합니다.
scatter()변수 간 관계를 보여주는 산점도를 생성합니다.
bar()범주형 데이터를 위한 막대 차트를 생성합니다.
histogram()데이터 분포 분석을 위한 히스토그램을 생성합니다.
line_series()하나의 차트에 여러 선 series를 표시합니다.
plot_table()Vega-Lite 사양을 사용해 맞춤형 차트를 생성합니다.

주요 사용 사례

모델 평가

  • 분류: 분류기 평가용 confusion_matrix(), roc_curve(), pr_curve()
  • 회귀: 예측값과 실제값을 비교하는 플롯용 scatter(), 잔차 분석용 histogram()
  • Vega-Lite 차트: 도메인별 시각화용 plot_table()

트레이닝 모니터링

  • 학습 곡선: 에포크별 메트릭을 추적하는 line() 또는 line_series()
  • 하이퍼파라미터 비교: 설정을 비교하는 bar() 차트

데이터 분석

  • 분포 분석: 특성 분포를 확인하는 histogram()
  • 상관관계 분석: 변수 간 관계를 보여주는 scatter() 산점도

시작하기

혼동 행렬 기록하기

import wandb

y_true = [0, 1, 2, 0, 1, 2]
y_pred = [0, 2, 2, 0, 1, 1]
class_names = ["class_0", "class_1", "class_2"]

# run 초기화
with wandb.init(project="custom-charts-demo") as run:
    run.log({
        "conf_mat": wandb.plot.confusion_matrix(
            y_true=y_true, 
            preds=y_pred,
            class_names=class_names
        )
    })

특성 분석용 산점도 만들기

import numpy as np

# 합성 데이터 생성
data_table = wandb.Table(columns=["feature_1", "feature_2", "label"])

with wandb.init(project="custom-charts-demo") as run:

    for _ in range(100):
        data_table.add_data(
            np.random.randn(), 
            np.random.randn(), 
            np.random.choice(["A", "B"])
        )

    run.log({
        "feature_scatter": wandb.plot.scatter(
            data_table, x="feature_1", y="feature_2",
            title="Feature Distribution"
        )
    })