Computer scienceData scienceInstrumentsScikit-learnMachine learning with scikit-learn

Hyperparameter search in scikit-learn

Sampling from the distribution

Report a typo

Note that this task assumes scikit-learn version 1.4.2

You have the following starter code:

from scipy.stats import loguniform
from sklearn.datasets import load_breast_cancer
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import RandomizedSearchCV
from sklearn.svm import SVC

X, y = load_breast_cancer(return_X_y=True)
scaler = StandardScaler()
X = scaler.fit_transform(X)
kernel = ['linear', 'rbf', 'poly']

Perform randomized hyperparameter search on SVC (read more about SVC), with random_state = 42 (important for reproducing the results), and other parameters kept to default. Pass loguniform(0.01, 1) to C and gamma (without calling .rvs() on the distribution), and the kernel values from the list to kernel as the parameter distribution of RandomizedSearchCV.

What is the optimal value of C, rounded up to the second decimal?

Enter a number

Create a free account to access the full topic