score:6

Accepted answer

Try:

clf = KNeighborsClassifier(n_neighbors = 10)
clf.fit(Xtrain,ytrain)

Classifier parameters go inside the constructor. You where trying to create a new object with an already instantiated classifier.

score:1

The following:

from sklearn.neighbors import KNeighborsClassifier
neigh = KNeighborsClassifier
clf = neigh(n_neighbors = 10)
clf.fit(Xtrain, ytrain)

would also work.


Related Query

More Query from same tag