@@ -162,10 +162,7 @@ def predict(self, X):
162162 Xqm = self ._qm_transform_by_group (self ._create_groups (X , climate_trend = True ))
163163
164164 # calculate the anomalies as a ratio of the training data
165- if self .return_anoms :
166- return self ._calc_ratio_anoms (Xqm , self .y_climo_ )
167- else :
168- return Xqm
165+ return self ._calc_ratio_anoms (Xqm , self .y_climo_ ) if self .return_anoms else Xqm
169166
170167 def _calc_ratio_anoms (self , obj , climatology , climate_trend = False ):
171168 """helper function for dividing day groups by climatology"""
@@ -181,29 +178,13 @@ def _calc_ratio_anoms(self, obj, climatology, climate_trend=False):
181178
182179 return result
183180
184- def _more_tags (self ):
185- return {
186- '_xfail_checks' : {
187- 'check_estimators_dtypes' : 'BCSD only suppers 1 feature' ,
188- 'check_dtype_object' : 'BCSD only suppers 1 feature' ,
189- 'check_fit_score_takes_y' : 'BCSD only suppers 1 feature' ,
190- 'check_estimators_fit_returns_self' : 'BCSD only suppers 1 feature' ,
191- 'check_estimators_fit_returns_self(readonly_memmap=True)' : 'BCSD only suppers 1 feature' ,
192- 'check_pipeline_consistency' : 'BCSD only suppers 1 feature' ,
193- 'check_estimators_nan_inf' : 'BCSD only suppers 1 feature' ,
194- 'check_estimators_overwrite_params' : 'BCSD only suppers 1 feature' ,
195- 'check_estimators_pickle' : 'BCSD only suppers 1 feature' ,
196- 'check_fit2d_predict1d' : 'BCSD only suppers 1 feature' ,
197- 'check_methods_subset_invariance' : 'BCSD only suppers 1 feature' ,
198- 'check_fit2d_1sample' : 'BCSD only suppers 1 feature' ,
199- 'check_dict_unchanged' : 'BCSD only suppers 1 feature' ,
200- 'check_dont_overwrite_parameters' : 'BCSD only suppers 1 feature' ,
201- 'check_fit_idempotent' : 'BCSD only suppers 1 feature' ,
202- 'check_n_features_in' : 'BCSD only suppers 1 feature' ,
203- 'check_fit_check_is_fitted' : 'BCSD only suppers 1 feature' ,
204- 'check_methods_sample_order_invariance' : 'temporal order matters' ,
205- },
206- }
181+ def __sklearn_tags__ (self ):
182+ from dataclasses import replace
183+
184+ tags = super ().__sklearn_tags__ ()
185+ # Skip tests - only supports 1 feature, temporal order matters
186+ tags = replace (tags , _skip_test = 'BCSD only supports 1 feature and temporal order matters' )
187+ return tags
207188
208189
209190class BcsdTemperature (BcsdBase ):
@@ -283,38 +264,20 @@ def rolling_func(x):
283264
284265 def _remove_climatology (self , obj , climatology , climate_trend = False ):
285266 """helper function to remove climatologies"""
286- dfs = []
287- for key , group in self ._create_groups (obj , climate_trend ):
288- if self .timestep == 'monthly' :
289- dfs .append (group - climatology .loc [key ].values )
290- elif self .timestep == 'daily' :
291- dfs .append (group - climatology .loc [key ].values )
292-
267+ dfs = [
268+ group - climatology .loc [key ].values
269+ for key , group in self ._create_groups (obj , climate_trend )
270+ if self .timestep in ['monthly' , 'daily' ]
271+ ]
293272 result = pd .concat (dfs ).sort_index ()
294273 if obj .shape != result .shape :
295274 raise ValueError ('shape of climo is not equal to input array' )
296275 return result
297276
298- def _more_tags (self ):
299- return {
300- '_xfail_checks' : {
301- 'check_estimators_dtypes' : 'BCSD only suppers 1 feature' ,
302- 'check_fit_score_takes_y' : 'BCSD only suppers 1 feature' ,
303- 'check_estimators_fit_returns_self' : 'BCSD only suppers 1 feature' ,
304- 'check_estimators_fit_returns_self(readonly_memmap=True)' : 'BCSD only suppers 1 feature' ,
305- 'check_dtype_object' : 'BCSD only suppers 1 feature' ,
306- 'check_pipeline_consistency' : 'BCSD only suppers 1 feature' ,
307- 'check_estimators_nan_inf' : 'BCSD only suppers 1 feature' ,
308- 'check_estimators_overwrite_params' : 'BCSD only suppers 1 feature' ,
309- 'check_estimators_pickle' : 'BCSD only suppers 1 feature' ,
310- 'check_fit2d_predict1d' : 'BCSD only suppers 1 feature' ,
311- 'check_methods_subset_invariance' : 'BCSD only suppers 1 feature' ,
312- 'check_fit2d_1sample' : 'BCSD only suppers 1 feature' ,
313- 'check_dict_unchanged' : 'BCSD only suppers 1 feature' ,
314- 'check_dont_overwrite_parameters' : 'BCSD only suppers 1 feature' ,
315- 'check_fit_idempotent' : 'BCSD only suppers 1 feature' ,
316- 'check_n_features_in' : 'BCSD only suppers 1 feature' ,
317- 'check_fit_check_is_fitted' : 'BCSD only suppers 1 feature' ,
318- 'check_methods_sample_order_invariance' : 'temporal order matters' ,
319- },
320- }
277+ def __sklearn_tags__ (self ):
278+ from dataclasses import replace
279+
280+ tags = super ().__sklearn_tags__ ()
281+ # Skip tests - only supports 1 feature, temporal order matters
282+ tags = replace (tags , _skip_test = 'BCSD only supports 1 feature and temporal order matters' )
283+ return tags
0 commit comments