What is a good range of values for the svm.SVC() hyperparameters to be explored via GridSearchCV()?

前端 未结 2 853
庸人自扰
庸人自扰 2021-02-01 19:00

I am running into the problem that the hyperparameters of my svm.SVC() are too wide such that the GridSearchCV() never gets completed! One idea is to u

2条回答
  •  终归单人心
    2021-02-01 19:35

    Which kernel works best depends a lot on your data. What is the number of samples and dimensions and what kind of data do you have? For the ranges to be comparable, you need to normalize your data, often StandardScaler, which does zero mean and unit variance, is a good idea. If your data is non-negative, you might try MinMaxScaler.

    For kernel="gamma", I usually do

    {'C': np.logspace(-3, 2, 6), 'gamma': np.logspace(-3, 2, 6)}
    

    which is based on nothing but served me well the last couple of years. I would strongly advice against non-logarithmic grids, and even more though against randomized search using discrete parameters. One of the main advantages of randomized search is that you can actually search continuous parameters using continuous distributions [see the docs].

提交回复
热议问题