Skip to content

[ENH] Rework of base series annotator API#6265

Merged
fkiraly merged 65 commits intosktime:mainfrom
alex-gregory-ds:refactor_base_series_annotator
Jun 1, 2024
Merged

[ENH] Rework of base series annotator API#6265
fkiraly merged 65 commits intosktime:mainfrom
alex-gregory-ds:refactor_base_series_annotator

Conversation

@alex-gregory-ds
Copy link
Copy Markdown
Contributor

@alex-gregory-ds alex-gregory-ds commented Apr 6, 2024

Reference Issues/PRs

See #3214 .

What does this implement/fix? Explain your changes.

Refactors the BaseSeriesAnnotator class:

  • Removes the fmt and label attributes.
  • Adds the learning_type and task attributes.
  • Adds default predict and transform method.
  • Adds default predict_points and predict_segments methods.
  • Adds methods for converting between dense and sparse output formats.
  • Adds default methods for predict and transform.

Does your contribution introduce a new dependency? If yes, which one?

No.

What should a reviewer concentrate their feedback on?

Did you add any tests for the change?

Any other comments?

PR checklist

For all contributions
  • I've added myself to the list of contributors with any new badges I've earned :-)
    How to: add yourself to the all-contributors file in the sktime root directory (not the CONTRIBUTORS.md). Common badges: code - fixing a bug, or adding code logic. doc - writing or improving documentation or docstrings. bug - reporting or diagnosing a bug (get this plus code if you also fixed the bug in the PR).maintenance - CI, test framework, release.
    See here for full badge reference
  • Optionally, for added estimators: I've added myself and possibly to the maintainers tag - do this if you want to become the owner or maintainer of an estimator you added.
    See here for further details on the algorithm maintainer role.
  • The PR title starts with either [ENH], [MNT], [DOC], or [BUG]. [BUG] - bugfix, [MNT] - CI, test framework, [ENH] - adding or improving code, [DOC] - writing or improving documentation or docstrings.
For new estimators
  • I've added the estimator to the API reference - in docs/source/api_reference/taskname.rst, follow the pattern.
  • I've added one or more illustrative usage examples to the docstring, in a pydocstyle compliant Examples section.
  • If the estimator relies on a soft dependency, I've set the python_dependencies tag and ensured
    dependency isolation, see the estimator dependencies guide.

@fkiraly
Copy link
Copy Markdown
Collaborator

fkiraly commented Apr 6, 2024

As discussed in the last developer meeting, the approach using tags is showcased here: #6271

This allows to keep all "property"-like attributes in one, inspectable place.

@fkiraly fkiraly added module:detection detectors module: outliers, change points, segmentation enhancement Adding new functionality API design API design & software architecture labels Apr 6, 2024
@fkiraly
Copy link
Copy Markdown
Collaborator

fkiraly commented Apr 11, 2024

PS: if you migrate to tags, you need to merge the parts of #6271 as well that add tags to the registry.

@alex-gregory-ds
Copy link
Copy Markdown
Contributor Author

I have rewritten the deprecation warning. I have also removed the deprecation warning for labels for the pyod adapter since the changes to BaseSeriesAnnotator do not deal with scores properly yet. This will come in a future PR.

If everyone else is happy are we ready to merge?

@alex-gregory-ds
Copy link
Copy Markdown
Contributor Author

Could someone please rerun the CI/CD pipeline? Looks like the docs jobs has failed due to running out of time to build. I don't think this as a result of changes introduced in this PR.

@fkiraly
Copy link
Copy Markdown
Collaborator

fkiraly commented May 22, 2024

Sure - rerunning

@fkiraly
Copy link
Copy Markdown
Collaborator

fkiraly commented May 22, 2024

Restarted - I also updated the deprecation messages and added release manager notes.

Question, it seems we want to remove the labels param in PyODAnnotator too - should there be a deprecation warning as well?

fkiraly
fkiraly previously approved these changes May 23, 2024
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.

I think we are ready to merge for release with 0.30.0.

@Alex-JG3, it would be great if you could check the updated warnings and release manager comments.

@alex-gregory-ds
Copy link
Copy Markdown
Contributor Author

Yes, happy with those changes. About the deprecation warning for indicator. I want to hold off until we have a better idea on how we are going to deal with scores particularly with sparse and dense scores. I think this is a job for a different PR so we should deprecate indicator in that PR.

@fkiraly
Copy link
Copy Markdown
Collaborator

fkiraly commented May 24, 2024

ok, let´s leave indicator in for now, then.

@fkiraly fkiraly changed the title [ENH] Refactor base series annotator [ENH] Rework of base series annotator API Jun 1, 2024
@fkiraly fkiraly merged commit 8ca6ae0 into sktime:main Jun 1, 2024
geetu040 pushed a commit to geetu040/sktime that referenced this pull request Jun 4, 2024
See sktime#3214 .


#### What does this implement/fix? Explain your changes.
<!--
A clear and concise description of what you have implemented.
-->

Reworks and refactors the `BaseSeriesAnnotator` class:

* Removes the `fmt` and `label` attributes.
* Adds the `learning_type` and `task` attributes.
* Adds default `predict` and `transform` method.
* Adds default `predict_points` and `predict_segments` methods.
* Adds methods for converting  between dense and sparse output formats.
* Adds default methods for `predict` and `transform`.

Also carries out a move of all existing annotation estimators to the new interface.
fkiraly pushed a commit that referenced this pull request Nov 24, 2024
…ode from detectors (#7425)

Please see #7388 for more
details.

- This PR is part of the effort to remove references to the `_fmt`
attribute in child detectors, following its deprecation in
#6265.
- The _fmt attribute was deprecated and hardcoded to sparse, making it
non-configurable by users. Therefore, removing branching logic based on
_fmt does not introduce regression, since methods like `predict_scores`
already defaulted to sparse output which was expected.
benHeid pushed a commit that referenced this pull request Feb 15, 2025
…ode from detectors (#7425)

Please see #7388 for more
details.

- This PR is part of the effort to remove references to the `_fmt`
attribute in child detectors, following its deprecation in
#6265.
- The _fmt attribute was deprecated and hardcoded to sparse, making it
non-configurable by users. Therefore, removing branching logic based on
_fmt does not introduce regression, since methods like `predict_scores`
already defaulted to sparse output which was expected.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

API design API design & software architecture enhancement Adding new functionality module:detection detectors module: outliers, change points, segmentation

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants