When specifying the score parameter (e.g., score="roc_auc") in the fit method of a model, an UnboundLocalError occurs:
This issue arises when the code attempts to reference best_params in params_preprocessing, but best_params has not been assigned.
The model should handle the score parameter without triggering an UnboundLocalError. If best_paramsis required, it should be initialized or assigned before it is accessed in params_preprocessing.
Description
When specifying the
score
parameter (e.g.,score="roc_auc"
) in thefit
method of a model, anUnboundLocalError
occurs:This issue arises when the code attempts to reference
best_params
inparams_preprocessing
, butbest_params
has not been assigned.The model should handle the score parameter without triggering an
UnboundLocalError
. Ifbest_params
is required, it should be initialized or assigned before it is accessed inparams_preprocessing
.