> ## Documentation Index
> Fetch the complete documentation index at: https://wb-21fd5541-serverless-sft-revamp.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# roc_curve()

export const GitHubLink = ({url}) => <a href={url} target="_blank" rel="noopener noreferrer" className="github-source-link">
    <svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
      <path d="M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z" />
    </svg>
    GitHub source
  </a>;

<GitHubLink url="https://github.com/wandb/wandb/blob/main/wandb/plot/roc_curve.py" />

### <kbd>function</kbd> `roc_curve`

```python theme={null}
roc_curve(
    y_true: 'Sequence[numbers.Number]',
    y_probas: 'Sequence[Sequence[float]] | None' = None,
    labels: 'list[str] | None' = None,
    classes_to_plot: 'list[numbers.Number] | None' = None,
    title: 'str' = 'ROC Curve',
    split_table: 'bool' = False
) → CustomChart
```

Receiver Operating Characteristic (ROC) 커브 차트를 생성합니다.

**Args:**

* `y_true`: 타겟 변수의 실제 클래스 라벨 (그라운드 트루스). 형태는 (num\_samples,) 여야 합니다.
* `y_probas`: 각 클래스에 대해 예측된 확률 또는 결정 점수. 형태는 (num\_samples, num\_classes) 여야 합니다.
* `labels`: `y_true` 의 클래스 인덱스에 해당하는 사람이 읽을 수 있는 라벨. 예를 들어, `labels=['dog', 'cat']` 인 경우 플롯에서 클래스 0은 'dog', 클래스 1은 'cat'으로 표시됩니다. None인 경우, `y_true` 의 원래 클래스 인덱스가 사용됩니다. 기본값은 None입니다.
* `classes_to_plot`: ROC 커브에 포함할 고유 클래스 라벨의 서브셋. None인 경우, `y_true` 에 있는 모든 클래스가 플롯됩니다. 기본값은 None입니다.
* `title`: ROC 커브 플롯의 제목. 기본값은 "ROC Curve"입니다.
* `split_table`: 테이블을 W\&B UI에서 별도의 섹션으로 분리할지 여부. `True` 인 경우, 테이블은 "Custom Chart Tables"라는 이름의 섹션에 표시됩니다. 기본값은 `False` 입니다.

**Returns:**

* `CustomChart`: W\&B에 로그할 수 있는 커스텀 차트 오브젝트. 차트를 로그하려면 `wandb.log()` 에 전달하세요.

**Raises:**

* `wandb.Error`: numpy, pandas 또는 scikit-learn을 찾을 수 없는 경우.

**Example:**

```python theme={null}
import numpy as np
import wandb

# 세 가지 질병에 대한 의료 진단 분류 문제 시뮬레이션
n_samples = 200
n_classes = 3

# 실제 라벨: 각 샘플에 "Diabetes", "Hypertension", "Heart Disease" 할당
# 각 샘플에 할당
disease_labels = ["Diabetes", "Hypertension", "Heart Disease"]
# 0: Diabetes, 1: Hypertension, 2: Heart Disease
y_true = np.random.choice([0, 1, 2], size=n_samples)

# 예측 확률: 각 샘플의 확률 합이 1이 되도록 시뮬레이션
# 각 샘플에 대해
y_probas = np.random.dirichlet(np.ones(n_classes), size=n_samples)

# 플롯할 클래스 지정 (세 가지 질병 모두 플롯)
classes_to_plot = [0, 1, 2]

# W&B run을 초기화하고 질병 분류를 위한 ROC 커브 플롯을 로그합니다
with wandb.init(project="medical_diagnosis") as run:
   roc_plot = wandb.plot.roc_curve(
        y_true=y_true,
        y_probas=y_probas,
        labels=disease_labels,
        classes_to_plot=classes_to_plot,
        title="ROC Curve for Disease Classification",
   )
   run.log({"roc-curve": roc_plot})
```
