Am 23.01.2013 18:39, schrieb Lars Buitinck:
>
> if you want more predictions or something...
> More in detail: OneVsRestClassifier exports an object called
> label_binarizer_, which is used to transform decision function values
> D back to class labels. By default, it picks all the classes for which
> D > 0, but its threshold argument can be used to change that.
>
> So, if clf is an OvR classifier and
>
>      D = clf.decision_function(x)
>
> for a *single sample* x contains no positive values, then
>
>      # untested, may contain mistakes
>      clf.label_binarizer_.inverse_transform(D, threshold=(D.max() + epsilon))
>
> will predict at least one class label for x, namely the one with the
> highest value according to the decision_function. The epsilon is
> needed because inverse_transform compares values using >, not >=; set
> it to a small value. Doing this for batches of samples is a bit more
> involved.
>
> Of course, you can set the threshold to any value. Whether any of this
> makes sense depends on your problem.
>
> [I used to be opposed to exporting the LabelBinarizer object on OvR
> estimators, but I guess I should give up the struggle now -- this is
> actually useful.]
>
I didn't even realize this possibility existed. I would have done it "by 
hand".
Thanks for the instructions.

------------------------------------------------------------------------------
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. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
_______________________________________________
Scikit-learn-general mailing list
Scikit-learn-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

Reply via email to