• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

yzhao062 / pyod / 25717592359
94%
master: 94%

Build:
Build:
LAST BUILD BRANCH: fix/update-to-pythresh-v1
DEFAULT BRANCH: master
Ran 12 May 2026 06:45AM UTC
Jobs 11
Files 184
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

12 May 2026 06:29AM UTC coverage: 93.753% (+0.8%) from 92.908%
25717592359

push

github

web-flow
fix(lunar): stop sharing scaler state across instances (closes #502) (#674)

`LUNAR.__init__` had `scaler=MinMaxScaler()` as a default argument,
which Python evaluates once at module import time. Two `LUNAR()`
instances therefore shared the same scaler object; the second `.fit`
re-fit it under a different feature dimensionality and silently
invalidated the first instance's `predict` (issue #502 reproducer
crashes with a shape error on the third `predict` call).

The fix:
- Default `scaler` to `None` and store the constructor arg verbatim
  on `self.scaler` (sklearn.base.clone requires that __init__ does not
  mutate its inputs — verified by the existing `test_model_clone`).
- Resolve a per-fit scaler in a new `_resolve_scaler` helper called
  from `fit`. The fitted scaler lives on `self.scaler_` (sklearn
  fitted-attribute convention); a fresh `MinMaxScaler()` is created
  when `scaler is None`, scaling is disabled when `scaler is False`,
  and any other instance is deep-copied so two LUNAR instances
  configured with the same scaler object cannot trample each other.
- Update `decision_function` and the train-time score path to read
  `self.scaler_` instead of `self.scaler`.

Two regression tests (`TestLUNARScalerIsolation`) reproduce the
original failure mode on master and pass on this branch.

AI disclosure: drafted with assistance from Claude (Anthropic).

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>

42 of 43 new or added lines in 2 files covered. (97.67%)

21 existing lines in 7 files now uncovered.

17905 of 19098 relevant lines covered (93.75%)

10.29 hits per line

Uncovered Changes

Lines Coverage ∆ File
1
88.96
-0.15% pyod/models/lunar.py

Coverage Regressions

Lines Coverage ∆ File
11
84.88
0.0% pyod/models/sos.py
3
94.32
0.03% pyod/models/dif.py
2
88.96
-0.15% pyod/models/lunar.py
2
96.88
3.13% pyod/models/suod.py
1
98.96
0.06% pyod/test/test_dif.py
1
99.08
0.11% pyod/test/test_sos.py
1
94.81
0.65% pyod/test/test_suod.py
Jobs
ID Job ID Ran Files Coverage
1 25717592359.1 12 May 2026 06:45AM UTC 184
92.94
GitHub Action Run
2 25717592359.2 12 May 2026 06:52AM UTC 184
92.94
GitHub Action Run
3 25717592359.3 12 May 2026 06:54AM UTC 184
93.73
GitHub Action Run
4 25717592359.4 12 May 2026 06:54AM UTC 184
93.73
GitHub Action Run
5 25717592359.5 12 May 2026 06:56AM UTC 184
93.73
GitHub Action Run
6 25717592359.6 12 May 2026 06:58AM UTC 184
93.73
GitHub Action Run
7 25717592359.7 12 May 2026 06:58AM UTC 184
93.73
GitHub Action Run
8 25717592359.8 12 May 2026 06:59AM UTC 184
92.94
GitHub Action Run
9 25717592359.9 12 May 2026 07:03AM UTC 184
93.73
GitHub Action Run
10 25717592359.10 12 May 2026 07:09AM UTC 184
93.73
GitHub Action Run
11 25717592359.11 12 May 2026 07:11AM UTC 184
93.73
GitHub Action Run
Source Files on build 25717592359
  • Tree
  • List 184
  • Changed 16
  • Source Changed 0
  • Coverage Changed 16
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • 7b0b7b51 on github
  • Prev Build on development (#25715013724)
  • Next Build on development (#25756069694)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc