Any suggestion about KNeighborsClassifier().predict_proba ?

On 3 September 2014 14:57, Sheila the angel <[email protected]> wrote:

> 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
>
------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
_______________________________________________
Scikit-learn-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

Reply via email to