RandomizedSearchCV optimizes model hyperparameters by sampling a user-defined number of configurations from discrete candidates or continuous distributions, then evaluating them with cross-validation. It is especially useful when exhaustive grid search is too expensive or when the promising parameter values are uncertain. section 3.4.3
Use randomized search when you need to:
- Explore a wider or higher-dimensional hyperparameter space with fewer evaluations than exhaustive grid search. section 3.4.3
- Sample continuous values, such as regularization strength, instead of restricting evaluation to a fixed list. section 3.4.3
- Retrieve the selected configuration through best_params_ and inspect evaluated configurations through cv_results_. section 3.4.3
Nonlinear cardiotoxicity model
A pipeline generates molecular fingerprints, adds degree-two interaction features, and trains an SGDClassifier. RandomizedSearchCV samples 20 configurations, scores them with five-fold cross-validation using F1, and searches L1 or L2 regularization, a continuous alpha value, fingerprint radii 2 or 4, and fingerprint sizes of 64, 128, or 256 bits. One selected configuration uses 128 bits, radius 2, and alpha 0.364. section 3.4.3

