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

# pr_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 소스 코드
  </a>;

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

### <kbd>함수</kbd> `pr_curve`

```python theme={null}
pr_curve(
    y_true: 'Iterable[T] | None' = None,
    y_probas: 'Iterable[numbers.Number] | None' = None,
    labels: 'list[str] | None' = None,
    classes_to_plot: 'list[T] | None' = None,
    interp_size: 'int' = 21,
    title: 'str' = 'Precision-Recall Curve',
    split_table: 'bool' = False
) → CustomChart
```

정밀도-재현율(PR) 곡선을 생성합니다.

정밀도-재현율 곡선은 특히 불균형 데이터셋에서 분류기를 평가할 때 유용합니다. PR 곡선 아래 면적이 크다는 것은 높은 정밀도(낮은 거짓 양성 비율)와 높은 재현율(낮은 거짓 음성 비율)을 모두 의미합니다. 이 곡선은 다양한 임곗값 수준에서 거짓 양성과 거짓 음성 간의 균형을 파악할 수 있게 해 주어 모델 성능 평가에 도움이 됩니다.

**Args:**

* `y_true`:  실제 이진 레이블입니다. shape는 (`num_samples`,)이어야 합니다.
* `y_probas`:  각 클래스에 대한 예측 점수 또는 확률입니다. 확률 추정치, 신뢰도 점수 또는 임곗값이 적용되지 않은 결정값일 수 있습니다. shape는 (`num_samples`, `num_classes`)이어야 합니다.
* `labels`:  플롯을 더 쉽게 해석할 수 있도록 `y_true`의 숫자 값을 대체할 클래스 이름의 선택 목록입니다. 예를 들어 `labels = ['dog', 'cat', 'owl']`이면 플롯에서 0은 'dog'로, 1은 'cat'으로, 2는 'owl'로 대체됩니다. 제공하지 않으면 `y_true`의 숫자 값이 사용됩니다.
* `classes_to_plot`:  플롯에 포함할 y\_true의 고유 클래스 값 선택 목록입니다. 지정하지 않으면 y\_true의 모든 고유 클래스가 플롯에 표시됩니다.
* `interp_size`:  재현율 값을 보간할 점의 개수입니다. 재현율 값은 \[0, 1] 범위에 균등하게 분포된 `interp_size`개의 점으로 고정되며, 정밀도는 이에 맞춰 보간됩니다.
* `title`:  플롯 제목입니다. 기본값은 "Precision-Recall Curve"입니다.
* `split_table`:  W\&B UI에서 table을 별도 section으로 분리할지 여부입니다. `True`이면 table은 "Custom Chart Tables"라는 이름의 section에 표시됩니다. 기본값은 `False`입니다.

**Returns:**

* `CustomChart`:  W\&B에 로깅할 수 있는 맞춤형 차트 객체입니다. 차트를 로깅하려면 `wandb.log()`에 전달하세요.

**Raises:**

* `wandb.Error`:  NumPy, pandas 또는 scikit-learn이 설치되어 있지 않은 경우 예외가 발생합니다.

**Example:**

```python theme={null}
import wandb

# 스팸 탐지 예시 (이진 분류)
y_true = [0, 1, 1, 0, 1]  # 0 = 스팸 아님, 1 = 스팸
y_probas = [
    [0.9, 0.1],  # 첫 번째 샘플의 예측 확률 (스팸 아님)
    [0.2, 0.8],  # 두 번째 샘플 (스팸), 이후 동일
    [0.1, 0.9],
    [0.8, 0.2],
    [0.3, 0.7],
]

labels = ["not spam", "spam"]  # 가독성을 위한 선택적 클래스 이름

with wandb.init(project="spam-detection") as run:
    pr_curve = wandb.plot.pr_curve(
         y_true=y_true,
         y_probas=y_probas,
         labels=labels,
         title="Precision-Recall Curve for Spam Detection",
    )
    run.log({"pr-curve": pr_curve})
```
