Hyperparameter tuning with sample weight

A model like GradientBoostingRegressor allows fit with sample_weights.
Is it possible to run a RandomizedSearchCV to optimize hyperparameters of such a model with sample_weights ?

thanks for help.

You can pass sample_weight when calling fit of RandomizedSearchCV.
It corresponds to the fit_params in the documentation: sklearn.model_selection.RandomizedSearchCV — scikit-learn 1.0.2 documentation

If the RandomizedSearchCV is in a cross_validate then, you need to pass sample_weight to fit_params parameter in cross_validate.

Many thanks it works !
Maybe one day I will understand the magic behind ‘**’ :wink: