I think the problem is in KNeighborsClassifier not in the grid_search.
This code runs without error
>>>clf = KNeighborsClassifier(n_neighbors=3, metric="euclidean")
>>>clf.fit(iris.data, iris.target)
While setting metric value later gives error
>>>clf = KNeighborsClassifier(n_neighbors=3)
>>>clf.metric="euclidean"
>>>clf.fit(iris.data, iris.target)
TypeError: __init__() got an unexpected keyword argument 'p'
On 25 August 2014 17:26, Lars Buitinck <[email protected]> wrote:
> 2014-08-25 17:12 GMT+02:00 Sheila the angel <[email protected]>:
> >>>>iris = datasets.load_iris()
> >>>>gp = {"n_neighbors":[2,3], "metric":['euclidean']}
> >>>>clf = GridSearchCV(KNeighborsClassifier(), gp, cv=4).fit(iris.data,
> >>>> iris.target)
> >
> >
> > TypeError: __init__() got an unexpected keyword argument 'p'
> >
> >
> > Why does it complain about 'p' ?
> >
> > Is it a bug?
>
> This is certainly a bug, and I can reproduce it with the latest master.
> https://github.com/scikit-learn/scikit-learn/issues/3589
>
>
> ------------------------------------------------------------------------------
> Slashdot TV.
> Video for Nerds. Stuff that matters.
> http://tv.slashdot.org/
> _______________________________________________
> Scikit-learn-general mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
>
------------------------------------------------------------------------------
Slashdot TV.
Video for Nerds. Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Scikit-learn-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general