this doesn't work with SGD_Classifier either, I tried Regressor afterwards.


On Mon, Jan 7, 2013 at 6:35 PM, Olivier Grisel <[email protected]>wrote:

> 2013/1/8 Ronnie Ghose <[email protected]>:
> > 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)
>
> This does not really make sense to fit a regressor model on a
> classification problem (the integer targets does not have a total
> ordering meaning).
>
> >
> >   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'
>
> That looks like a bug. Could you open a new github issue?
>
>
> --
> Olivier
> http://twitter.com/ogrisel - http://github.com/ogrisel
>
>
> ------------------------------------------------------------------------------
> 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
>
------------------------------------------------------------------------------
Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS
and more. Get SQL Server skills now (including 2012) with LearnDevNow -
200+ hours of 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_122512
_______________________________________________
Scikit-learn-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

Reply via email to