Am 23.01.2013 18:39, schrieb Lars Buitinck:
> 2013/1/23 Andreas Mueller <amuel...@ais.uni-bonn.de>:
>> Am 23.01.2013 16:47, schrieb Philipp Singer:
>>> That's what I originally thought, but then I tried it with just using
>>> LinearSVC and it magically worked for my sample dataset, really
>>> interesting. I think it is working now properly.
>> I'm pretty sure it shouldn't.
>
> Nope, it shouldn't.
>
>>> What I am asking myself is how exactly the decision is made for the
>>> multilabel prediction. Is there some way of influencing it? For example
>>> sometimes it predicts zero classes and sometimes several.
>> OneVsRestClassifier does - surprise - one-vs-rest classification.
>> This means there is a binary classifier pre class. If none of these
>> predict class presence, no class is predicted...
>> You could try using different thresholds on the decision_function,
>> 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.]
>

Very nice explanation. Thanks for that, I'll try it out!

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