Skip to content

fix: accept plain lists in PYODScoreEnsembler.transform_partial - #213

Merged
selimfirat merged 2 commits into
selimfirat:masterfrom
drakeo338:claude/208-fix
Sep 29, 2026
Merged

selimfirat merged 2 commits into
selimfirat:masterfrom
drakeo338:claude/208-fix

Conversation

@drakeo338

Copy link
Copy Markdown
Contributor

Fixes #208.

PYODScoreEnsembler.transform_partial called scores.reshape(1, -1) directly, so passing a plain list of scores (the natural way to collect one score per detector) raised AttributeError: 'list' object has no attribute 'reshape'. The fix converts the input with np.asarray(scores, dtype=np.float64) before reshaping, so a list and the equivalent array now give identical results. Added a test in tests/transform/ensemble/test_ensemblers.py that checks each ensembler against both input forms.

transform_partial called ndarray.reshape() directly on the scores
argument, so passing a plain Python list (as opposed to a numpy
array) raised AttributeError. Coerce scores to a float64 ndarray
before reshaping so all five PyOD-based ensemblers accept list
input, matching their documented "List of scores" argument type.

Fixes selimfirat#208.
@github-actions

Copy link
Copy Markdown

Thanks for your first pull request to PySAD! CI will run the tests shortly. Please make sure the change comes with a test and, for new features or models, a note in CHANGES.txt. See .github/CONTRIBUTING.md for the full checklist.

@selimfirat selimfirat left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this looks good. The fix is exactly what #208 asked for and the test covers all five ensemblers.

@selimfirat
selimfirat merged commit 2bfb5ec into selimfirat:master Sep 29, 2026
7 of 13 checks passed
@selimfirat selimfirat added the bug Something isn't working label Oct 16, 2026
@selimfirat selimfirat mentioned this pull request Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug in the score ensemblers: a list of scores raises AttributeError

2 participants