简体   繁体   中英

Python : GridSearchCV is taking too long to execute

I am running GridSearchCV on small dataset, which size is (13380,37) and code is as below:

from sklearn.model_selection import RandomizedSearchCV,GridSearchCV
parameters = {kernel:('linear','rbf','poly'),'C':[1.5,2,3,4,5,6,7,8,9,10],'gamma':[1e-7,1e-6,1e-4,1e-3,1e-2]}
svc = SVC() 
clf = GridSearchCV(svc,parameters,n_jobs=38)
search = clf.fit(X_train,y_train)
search.best_params_

It is running for more than a day. But with the same parameters if i run it on iris dataset,it is giving the result in 1 min. The data is standardized and using multiprocessing too. Am i missing anything here.

I think the problem is with the njobs you indicated. change it from 38 to -1 and that should do the job fast enough.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM