Skip to content

v1.2.1

Latest

Choose a tag to compare

@mjuez mjuez released this 04 May 15:45
v1.2.1
35fa9bf

Bug fixes

Two bugs in dens() surfaced while diagnosing a confusing LOOCV plot reported by a user.

dens() now honours p.rope for the ROPE axvlines

Before, the orange ROPE lines were drawn at hardcoded ±0.01 regardless of the rope parameter passed to CorrelatedTTest. If you used a non-conventional rope (e.g. 0.001 or 0.05), the lines on screen did not match the rope used by the test — silently misleading. They now sit at exactly ±p.rope.

dens() now fails loudly on degenerate posteriors

Before, calling dens() on a posterior with var = 0 (typical when the two input score arrays are identical) produced an unhelpful ValueError: Axis limits cannot be NaN or Inf from inside matplotlib. It now raises an explicit ValueError describing the cause.

```python
ValueError: Cannot draw density: posterior variance is np.float64(0.0).
The two classifiers likely produced identical scores;
the posterior is degenerate and has no density to plot.
```

The check covers var = 0, var < 0, and var = NaN.

Compatibility

  • No public API changes. Color, dens, tern keep the same signatures.
  • The fix is a no-op for callers using the default rope=0.01.
  • New behaviour is strictly an improvement: correct visual output for non-default ropes, clear error message for degenerate posteriors.

Tests

Four new tests added to the suite (now 23/23):

  • Parametrised over rope ∈ {0.001, 0.01, 0.05}, asserts the two ROPE axvlines fall at exactly ±rope.
  • Asserts ValueError with "degenerate" in the message when the posterior has var=0.

Install

```
pip install -U baycomp_plotting
```

Full diff: v1.2.0...v1.2.1