def set_default_params(self, accuracy=None, time_tolerance=None, interpretability=None, **kwargs): # First call the XGBoostGBMModel set_default_params # This will input all model parameters just like DAI would do. XGBoostGBMModel.set_default_params(self, accuracy=accuracy, time_tolerance=time_tolerance, interpretability=interpretability, **kwargs) # Now we just need to tell XGBoost that it has to optimize for our custom objective # And we are done self.params["objective"] = custom_asymmetric_objective
def mutate_params(self, get_best=False, time_tolerance=None, accuracy=None, interpretability=None, imbalance_ratio=None, train_shape=None, ncol_effective=None, time_series=False, ensemble_level=None, score_f_name: str = None, **kwargs): # If we don't override the parent mutate_params method, DAI would have the opportunity # to modify the objective and select the winner # For demonstration purposes we purposely make sure that the objective # is the one we want # So first call the parent method to mutate parameters params = XGBoostGBMModel.mutate_params( self, get_best=get_best, time_tolerance=time_tolerance, accuracy=accuracy, interpretability=interpretability, imbalance_ratio=imbalance_ratio, train_shape=train_shape, ncol_effective=ncol_effective, time_series=time_series, ensemble_level=ensemble_level, score_f_name=score_f_name, **kwargs) # Now set the objective that DAI could have mutated params["objective"] = custom_asymmetric_objective