1+ """Integration adapter for sktime detector experiments.
2+
3+ Provides `SktimeDetectorExperiment` which adapts sktime detector-style
4+ objects to the Hyperactive experiment interface.
5+ """
6+
17import numpy as np
28from skbase .utils .dependencies import _check_soft_dependencies
39
@@ -118,16 +124,16 @@ def _evaluate(self, params):
118124 return res_float , {"results" : results }
119125
120126 # Fallback: perform a manual cross-validation loop if `evaluate` is not present.
121- from sklearn .base import clone as skl_clone
122127
123128 # Determine underlying metric function or sklearn-style scorer
124129 metric_func = getattr (self ._scoring , "_metric_func" , None )
125130 is_sklearn_scorer = False
126131 if metric_func is None :
127- # If _scoring is a sklearn scorer callable that accepts (estimator, X, y)
128- # we will call it directly with the fitted estimator.
132+ # If _scoring is a sklearn scorer callable that accepts
133+ # (estimator, X, y) we will call it directly with the fitted estimator.
129134 if callable (self ._scoring ):
130- # heuristics: sklearn scorers produced by make_scorer take (estimator, X, y)
135+ # Heuristic: sklearn scorers produced by `make_scorer` take
136+ # arguments `(estimator, X, y)`.
131137 is_sklearn_scorer = True
132138 else :
133139 metric = metric_func
@@ -138,7 +144,7 @@ def _evaluate(self, params):
138144 for train_idx , test_idx in self ._cv .split (self .y ):
139145 X_train = None
140146 X_test = None
141- if isinstance (self .y , ( list , tuple ) ):
147+ if isinstance (self .y , list | tuple ):
142148 y_train = [self .y [i ] for i in train_idx ]
143149 y_test = [self .y [i ] for i in test_idx ]
144150 else :
@@ -200,10 +206,10 @@ def _evaluate(self, params):
200206 return float (res_float ), {"results" : {"cv_scores" : scores }}
201207
202208 def _safe_index (self , obj , idx ):
203- """
204- Safely index into `obj` using integer indices.
209+ """Safely index into `obj` using integer indices.
205210
206- Supports pandas objects with .iloc, numpy arrays/lists, and other indexable types.
211+ Supports pandas objects with ``.iloc``, numpy arrays/lists, and other
212+ indexable types.
207213 """
208214 try :
209215 return obj .iloc [idx ]
@@ -218,7 +224,11 @@ def _safe_index(self, obj, idx):
218224
219225 @classmethod
220226 def get_test_params (cls , parameter_set = "default" ):
221- # Return testing parameter settings for the skbase object.
227+ """Return testing parameter settings for the skbase object.
228+
229+ This returns a list or dict appropriate to construct test instances
230+ for this class. See the skbase test helpers for expected formats.
231+ """
222232 if _check_soft_dependencies ("sktime" , severity = "none" ):
223233 try :
224234 from sktime .annotation .dummy import DummyDetector
0 commit comments