Hello,

I've been using gridSearchCV for parameter tuning on the scikit-learn
Kaggle data set and getting incorrect results. In particular, when I run
the following, all combinations of parameters give a score of 1 which I
assure you is not actually the case.

CODE:

import csv as csv
import numpy as np
from sklearn import grid_search, metrics
from sklearn.svm import SVC
from sklearn import preprocessing as pp

pg=[{'C':[.01,.1,1.0,10.0],'gamma':[.1,.01,.001,.0001]}]
svr = SVC()
grid = grid_search.GridSearchCV(svr, pg)
grid = grid.fit(X_train, y_target)
print("The best classifier is: ", grid.best_estimator_)
print("Here are the grid scores: ", grid.grid_scores_)

OUTPUT:
The best classifier is:  SVC(C=0.001, cache_size=200, class_weight=None,
coef0=0.0, degree=3,
  gamma=0.1, kernel=rbf, max_iter=-1, probability=False, shrinking=True,
  tol=0.001, verbose=False)
Here are the grid scores: [({'gamma': 0.1, 'kernel': 'rbf', 'C': 0.001},
1.0, array([ 1.,  1.,  1.])), ({'gamma': 0.01, 'kernel': 'rbf', 'C':
0.001}, 1.0, array([ 1.,  1.,  1.]))...

I'm using python 3.3 and 0.13.1 and I have spent 10+ hours trying to figure
out what I am doing wrong. Does anybody have any thoughts?

BTW- when I just create an SVC with C = 10.0 and gamma = .01, the resulting
model works perfectly. It's only gridsearch that doesn't seem to be working.

Regards,
Max
------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
Scikit-learn-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

Reply via email to