2012/5/18 Mathieu Blondel <[email protected]>: > 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).
LabelBinarizer has the (undocumented) feature that it accepts an indicator matrix as well as an array-like of labels and a list of lists of labels, so checking for 1-d input might break things elsewhere. -- Lars Buitinck Scientific programmer, ILPS University of Amsterdam ------------------------------------------------------------------------------ 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
