I am using KNeighborsClassifier and trying to obtain probabilistic output.
But for many of the test sets I am getting equal probability for all class.

>>>X_train, X_test, y_train, y_test =
cross_validation.train_test_split(iris.data, iris.target, test_size=0.4,
random_state=0)

>>>clf = KNeighborsClassifier(n_neighbors=4).fit(X_train, y_train)

>>>clf.predict_proba(X_test)

#An example output

 [ 0.    0.5   0.5 ]

 [ 0.    0.5   0.5 ]

 [ 0.    1.    0.  ]

Do the prediction of class label via function .predict in
KNeighborsClassifier use .predict_proba ?


In my another data-set the probability values for two particular classes
are most of the time equal (as shown in the example).

How do I break the tie in such cases?

Thanks
--
Sheila
------------------------------------------------------------------------------
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

Reply via email to