@@ -171,7 +171,13 @@ def _get_single_tuner(self, tuner: BaseTuner) -> Tuple[Dict[str, BaseTuner], Dic
171171 return _search_space , _tuner_model_class_map
172172
173173
174- def only_compatible_with_data (self , X : Iterable , y : Iterable , probability_score : bool = False ) -> Iterable [str ]:
174+ def only_compatible_with_data (
175+ self ,
176+ X : Iterable [Any ],
177+ y : Iterable [Any ],
178+ probability_score : bool = False ,
179+ tag_filters : Optional [Dict [str , Any ]]= None
180+ ) -> Iterable [str ]:
175181 r"""
176182 This method checks the tuners in the search space that are incompatible
177183 with the given data, and automatically exludes them from the search space
@@ -197,6 +203,9 @@ def only_compatible_with_data(self, X: Iterable, y: Iterable, probability_score:
197203 verify if `model_class` can output probability scores. Only useful
198204 if `self.task="classification"`
199205
206+ tag_filters: Dict[str, Any]
207+ Use to filter model by their tags (using the model._get_tags() call)
208+
200209 Return
201210 ------
202211 tuners: Iterable[str]
@@ -220,12 +229,18 @@ def only_compatible_with_data(self, X: Iterable, y: Iterable, probability_score:
220229 " in the model_class of your custom tuner" )
221230
222231 try :
223- _model .fit (X , y )
224- _model .predict (X )
232+ if tag_filters is not None :
233+ model_tags = _model ._get_tags ()
234+ for k in tag_filters :
235+ if model_tags [k ] != tag_filters [k ]:
236+ raise Exception ()
225237
226238 if probability_score :
227239 if self .task == "classification" and not hasattr (_model , "predict_proba" ):
228240 raise AttributeError ()
241+
242+ _model .fit (X , y )
243+ _model .predict (X )
229244
230245 except Exception as e :
231246 if tuner_name in self .search_space .keys ():
0 commit comments