I have a Dataset with 580 samples and 7 features. I compared the time between three kernels: Linear, Quadratic and Gaussian and using RandomizedSearchCV as the following:
from sklearn.model_selection import RandomizedSearchCV
from sklearn.preprocessing import StandardScaler
paramSVMLinear = {
'kernel': ['linear'],
'C': [ii for ii in np.linspace(1,1e7,50000)]
}
scal = StandardScaler()
X = scal.fit_transform(X)
RandomizedSearchCV(SVC(), paramSVMLinear, n_iter=1, cv=2, scoring='accuracy', verbose=4).fit(X_train,Y_train)
SVC(kernel = 'linear').fit(X_train,Y_train)
SVC(kernel = 'poly',degree=2).fit(X_train,Y_train)
SVC(kernel = 'rbf').fit(X_train,Y_train)
The elapsed time in each fit is 187.64 sec, 0.001672 sec, 0.00187 sec, 0.001586 sec. Why the randomized search take so long for 1 iteration and 2 CV? Why the linear kernel take a longer time than RBF? Thanks!