Can anyone please tell me what I'm doing wrong?

The example here (
http://scikit-learn.org/dev/modules/generated/sklearn.grid_search.GridSearchCV.html
)

>>> from sklearn import svm, grid_search, datasets>>> iris = 
>>> datasets.load_iris()>>> parameters = {'kernel':('linear', 'rbf'), 'C':[1, 
>>> 10]}>>> svr = svm.SVC()>>> clf = grid_search.GridSearchCV(svr, 
>>> parameters)>>> clf.fit(iris.data, iris.target)...                           
>>>   GridSearchCV(cv=None,    estimator=SVC(C=1.0, cache_size=..., coef0=..., 
>>> degree=...,        gamma=..., kernel='rbf', max_iter=-1, probability=False, 
>>>        shrinking=True, tol=...),    fit_params={}, iid=True, 
>>> loss_func=None, n_jobs=1,        param_grid=...,        ...)

gives .98

when i change svr and the parameters:



from sklearn import svm, grid_search, datasets,linear_model

iris = datasets.load_iris()
parameters = {'alpha':[.0001,.001]}
sgd = linear_model.SGDRegressor()
clf = grid_search.GridSearchCV(sgd, parameters)
clf.fit(iris.data, iris.target)
print clf.best_score_


suddenly I get


Traceback (most recent call last):
  File "GridSearch_SGDRegressor.py", line 6, in <module>
    clf.fit(iris.data, iris.target)

  File "/usr/local/lib/python2.7/dist-packages/sklearn/grid_search.py",
line 415, in fit
    best_estimator.fit(X, y, **self.fit_params)
AttributeError: 'NoneType' object has no attribute 'fit'


this seems like an error since I'm running 0.13 and
http://scikit-learn.org/dev/modules/generated/sklearn.linear_model.SGDRegressor.html#sklearn.linear_model.SGDRegressor.fit

says that it _does_ have fit, and fit works independently for me.

It seems the interface between them is broken somehow?
------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122412
_______________________________________________
Scikit-learn-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

Reply via email to