On Fri, May 18, 2012 at 6:39 AM, Ian Goodfellow <[email protected]>wrote:

> If the class label vector passed to the "fit" method of
> OneVsRestClassifier has shape (n,1) instead of shape (n,),
> then really weird results happen. In this example script here, when
> the fit SVM is asked to predict the labels of
> 1000 examples, the resulting prediction vector has shape (45000,1),
> not (1000,) as expected.
>

Thanks for reporting. I could reproduce the problem. So the "issue" seems
to be in LabelBinarizer. To fix this, I suggest that we just raise an error
in LabelBinarizer when the input to fit has 2d shape. Personaly, I'm not in
favor of converting an array of shape (n_samples, 1) to (n_samples, )
behind the scenes. The reason is because those shapes have different
semantics. If we start accepting arrays of shape (n_samples, 1), I would
expect arrays of shape (n_samples, n_tasks) to work too (just like
multivariate regression).

PR welcome :)

Mathieu
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Scikit-learn-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

Reply via email to