#12786·wandb

[Bug]: plot.pr_curve: correct probability and label container annotations

Author: humdrum00001010Created Sep 10, 2026Updated Sep 15, 2026

Describe the bug

wandb.plot.pr_curve annotates y_probas as Iterable[numbers.Number] | None, a one-dimensional container of scalar numbers. Its documented and supported input is two-dimensional probabilities, one row per sample and one column per class. The implementation indexes y_probas[:, i].

The same function also advertises an arbitrary Iterable for y_true, but a normal iterator is not materialized into a label array and fails downstream. These are contradictions in the function's declared container contract.

Main retains the signature and documented shape and two-dimensional indexing. The existing unit test uses nested probabilities.

Minimal reproduction

python
import wandb

probabilities = [[0.4, 0.6], [0.8, 0.2]]
chart = wandb.plot.pr_curve([0, 1], probabilities, interp_size=4)
print(len(chart.table.data))  # 8

wandb.plot.pr_curve([0, 1], [0.4, 0.8], interp_size=4)

The scalar-container call raises:

IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed

Separately, wandb.plot.pr_curve(iter([0, 1]), probabilities, interp_size=4) raises scikit-learn InvalidParameterError: the pos_label receives the list_iterator object. The equivalent list control succeeds. No W&B run or server is involved.

Expected behavior

Describe the required probability nesting and supported label containers accurately, or handle the additional advertised forms.

Environment

  • W&B SDK: 0.30.0; relevant source is identical on main 8f93d444e29e4d1a50a888899f51051012ee2679
  • Python: 3.12.12
  • NumPy: 2.5.3; scikit-learn: 1.9.0; SciPy: 1.18.1
  • OS: macOS 26.1, arm64
  • W&B server: not applicable