Skip to content

fix: get_test_params uses self instead of cls in several metric classes#876

Merged
fkiraly merged 1 commit intosktime:mainfrom
OmAmbole009:fix/get-test-params-classmethod-self-to-cls
Mar 13, 2026
Merged

fix: get_test_params uses self instead of cls in several metric classes#876
fkiraly merged 1 commit intosktime:mainfrom
OmAmbole009:fix/get-test-params-classmethod-self-to-cls

Conversation

@OmAmbole009
Copy link
Copy Markdown
Contributor

Fixes #875

What

Replaced self with cls and added parameter_set="default" argument
in get_test_params classmethods for four metric classes in
skpro/metrics/_classes.py.

Why

@classmethod methods receive the class as first argument, which by
convention must be named cls, not self. Using self implies an
instance method and is incorrect. This was inconsistent with
PinballLoss, LogLoss, CRPS, SquaredDistrLoss and AUCalibration
in the same file, which all correctly use cls.

Classes fixed

  • EmpiricalCoverage
  • IntervalWidth
  • ConstraintViolation
  • LinearizedLogLoss

Change

  • skpro/metrics/_classes.py: 4 occurrences of get_test_params(self)
    replaced with get_test_params(cls, parameter_set="default")

@OmAmbole009
Copy link
Copy Markdown
Contributor Author

Hi @fkiraly @felipeangelimvieira Review this Pr.

Copy link
Copy Markdown
Collaborator

@fkiraly fkiraly left a comment

Choose a reason for hiding this comment

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

That's right, thanks!

How did this not get detected by tests?

@fkiraly fkiraly added enhancement module:metrics&benchmarking metrics and benchmarking modules labels Mar 11, 2026
@fkiraly fkiraly merged commit d392a68 into sktime:main Mar 13, 2026
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement module:metrics&benchmarking metrics and benchmarking modules

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: get_test_params uses self instead of cls in several metric classes

3 participants