Skip to content

Commit

Permalink
[BUG] fix dependent tags of TimeSeriesDBSCAN (#6322)
Browse files Browse the repository at this point in the history
`TimeSeriesDBSCAN` does not set its tags correctly if one of the `numba`
based distance in `sktime` is used. In this case, it cannot support
unequal length time series, and the corresponding tag needs to be set.

Similarly, the tags for some of the `numba` distances were set
incorrectly, which is now corrected as well.
  • Loading branch information
fkiraly committed Apr 23, 2024
1 parent 899ce0e commit c5f425d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
9 changes: 9 additions & 0 deletions sktime/clustering/dbscan.py
Expand Up @@ -104,6 +104,15 @@ def __init__(
]
self.clone_tags(distance, tags_to_clone)

# numba distance in sktime (indexed by string)
# cannot support unequal length data, and require numpy3D input
if isinstance(distance, str):
tags_to_set = {
"X_inner_mtype": "numpy3D",
"capability:unequal_length": False,
}
self.set_tags(**tags_to_set)

self.dbscan_ = None

def _fit(self, X, y=None):
Expand Down
1 change: 1 addition & 0 deletions sktime/dists_kernels/dtw/_dtw_sktime.py
Expand Up @@ -131,6 +131,7 @@ class DtwDist(BasePairwiseTransformerPanel):
# --------------
"symmetric": True, # all the distances are symmetric
"X_inner_mtype": "numpy3D",
"capability:unequal_length": False, # can dist handle unequal length panels?
}

def __init__(
Expand Down
1 change: 1 addition & 0 deletions sktime/dists_kernels/edit_dist.py
Expand Up @@ -123,6 +123,7 @@ class EditDist(BasePairwiseTransformerPanel):
# --------------
"symmetric": True, # all the distances are symmetric
"X_inner_mtype": "numpy3D",
"capability:unequal_length": False, # can dist handle unequal length panels?
}

ALLOWED_DISTANCE_STR = ["lcss", "edr", "erp", "twe"]
Expand Down

0 comments on commit c5f425d

Please sign in to comment.