Skip to content

Commit

Permalink
Merge branch 'refactor_base_series_annotator' of https://github.com/A…
Browse files Browse the repository at this point in the history
…lex-JG3/sktime into pr/6265
  • Loading branch information
fkiraly committed May 19, 2024
2 parents 2f7cfc1 + b0abeb7 commit b8f8ee6
Show file tree
Hide file tree
Showing 11 changed files with 601 additions and 55 deletions.
9 changes: 7 additions & 2 deletions extension_templates/annotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ class MySeriesAnnotator(BaseSeriesAnnotator):
and so on
"""

# Change the `task` and `learning_type` as needed
_tags = {
"task": "segmentation",
"learning_type": "unsupervised",
}

# todo: add any hyper-parameters and components to constructor
def __init__(
self,
Expand All @@ -77,8 +83,7 @@ def __init__(
self.paramb = paramb
self.paramc = paramc

# Change the `task` and `learning_type` as needed
super().__init__(task="segmentation", learning_type="unsupervised")
super().__init__()

# todo: optional, parameter checking logic (if applicable) should happen here
# if writes derived values to self, should *not* overwrite self.parama etc
Expand Down
12 changes: 7 additions & 5 deletions sktime/annotation/adapters/_pyod.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,17 @@ class PyODAnnotator(BaseSeriesAnnotator):
estimator : PyOD estimator
See ``https://pyod.readthedocs.io/en/latest/`` documentation for a detailed
description of all options.
learning_type : str {"supervised", "unsupervised"}, optional (default="unsupervised")
The learning type of the annotator; can be supervised or unsupervised.
"""

_tags = {"python_dependencies": "pyod"}
_tags = {
"python_dependencies": "pyod",
"task": "anomaly_detection",
"learning_type": "unsupervised",
}

def __init__(self, estimator, learning_type="unsupervised"):
def __init__(self, estimator):
self.estimator = estimator # pyod estimator
super().__init__(task="anomaly_detection", learning_type=learning_type)
super().__init__()

def _fit(self, X, Y=None):
"""Fit to training data.
Expand Down
Loading

0 comments on commit b8f8ee6

Please sign in to comment.