Hyperparameter search
A parameter search compares a declared set of model settings using the same validation plan. It doesn't turn the test set into another tuning table. You will fit a small search, read losses in their natural units and evaluate the selected model once on a held-out partition. Pipeline parameter names include the step name and two _ characters. The scorer also matters: maximizing a negative loss is equivalent to minimizing its positive value. If candidates tie, use a rule chosen before examining the test score. The smaller model wins the tie in this lesson because the operational requirement says so.
search = GridSearchCV(base, {'logisticregression__C': [0.1, 1.0]}, cv=cv, scoring='roc_auc').fit(X_train, y_train)
The search fits preparation inside each fold and refits the selected candidate on the training partition.