> ## Documentation Index
> Fetch the complete documentation index at: https://docs.coreweave.com/llms.txt
> Use this file to discover all available pages before exploring further.

# pr_curve()

export const GitHubLink = ({url, compact = false}) => <a href={url} target="_blank" rel="noopener noreferrer" className={compact ? "source-link" : "github-source-link"}>
    {compact ? "View source" : <>
    <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 compact url="https://github.com/wandb/wandb/blob/main/wandb/plot/pr_curve.py#L19" />

<h2 id="function-wandbplotpr_curve">
  <Badge color="blue" size="lg" shape="rounded">함수</Badge> wandb.plot.pr\_curve()
</h2>

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

정밀도-재현율 곡선은 불균형 데이터셋에서 분류기를 평가하는 데 특히 유용합니다. PR 곡선 아래의 넓은 면적은 높은 정밀도(낮은 오탐률)와 높은 재현율(낮은 미탐률)을 모두 의미합니다. 이 곡선은 다양한 임계값 수준에서 오탐과 미탐 사이의 균형에 대한 통찰을 제공하여 모델의 성능 평가를 돕습니다.

```python theme={"system"}
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
```

<h2 id="args">
  인수
</h2>

<ResponseField name="y_true" type="Iterable[T] | None">
  True binary labels. The shape should be (`num_samples`,).
</ResponseField>

<ResponseField name="y_probas" type="Iterable[numbers.Number] | None">
  Predicted scores or probabilities for each 클래스. These can be probability estimates, confidence scores, or non-thresholded decision values. The shape should be (`num_samples`, `num_classes`).
</ResponseField>

<ResponseField name="labels" type="list[str] | None">
  클래스 이름의 선택 목록으로, `y_true`의 숫자 값을 대체하여 플롯 해석을 쉽게 합니다. 예를 들어, `labels = ['dog', 'cat', 'owl']`은 플롯에서 0을 'dog', 1을 'cat', 2를 'owl'로 대체합니다. 제공되지 않으면 `y_true`의 숫자 값이 사용됩니다.
</ResponseField>

<ResponseField name="classes_to_plot" type="list[T] | None">
  y\_true의 고유 클래스 값 선택 목록으로, 플롯에 포함할 클래스입니다. 지정되지 않으면 y\_true의 모든 고유 클래스가 플롯됩니다.
</ResponseField>

<ResponseField name="interp_size" type="int">
  재현율 값을 보간할 포인트 수입니다. 재현율 값은 \[0, 1] 범위에서 균등하게 분포된 `interp_size` 포인트로 고정되며, 정밀도는 그에 따라 보간됩니다.
</ResponseField>

<ResponseField name="title" type="str">
  플롯의 제목입니다. 기본값은 "정밀도-재현율 Curve"입니다.
</ResponseField>

<ResponseField name="split_table" type="bool">
  테이블을 W\&B UI의 별도 섹션으로 분할할지 여부입니다. `True`이면 테이블이 "Custom Chart Tables"라는 섹션에 표시됩니다. 기본값은 `False`입니다.
</ResponseField>

<h2 id="returns">
  반환값
</h2>

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

<h2 id="raises">
  예외
</h2>

* `wandb.Error`: NumPy, pandas 또는 scikit-learn이 설치되어 있지 않은 경우.

<h2 id="examples">
  예시
</h2>

```python theme={"system"}
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})
```
