Repository navigation
fix: accept plain lists in PYODScoreEnsembler.transform_partial - #213
Merged
Merged
Conversation
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.
|
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 |
selimfirat
approved these changes
Sep 29, 2026
selimfirat
left a comment
Owner
There was a problem hiding this comment.
Thanks, this looks good. The fix is exactly what #208 asked for and the test covers all five ensemblers.
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #208.
PYODScoreEnsembler.transform_partialcalledscores.reshape(1, -1)directly, so passing a plain list of scores (the natural way to collect one score per detector) raisedAttributeError: 'list' object has no attribute 'reshape'. The fix converts the input withnp.asarray(scores, dtype=np.float64)before reshaping, so a list and the equivalent array now give identical results. Added a test intests/transform/ensemble/test_ensemblers.pythat checks each ensembler against both input forms.