On Mon, Feb 27, 2012 at 6:15 PM, Olivier Grisel
<[email protected]> wrote:
> Cool, I did not know that the binary case was handled as well.
Actually most of the logic is in LabelBinarizer.
>>> from sklearn.preprocessing import LabelBinarizer
>>> lb = LabelBinarizer()
>>> lb.fit_transform([1, 2, 2, 2])
array([[ 0.],
[ 1.],
[ 1.],
[ 1.]])
>>> lb.fit_transform([1, 2, 2, 3])
array([[ 1., 0., 0.],
[ 0., 1., 0.],
[ 0., 1., 0.],
[ 0., 0., 1.]])
This way, only one coefficient vector is required in the binary case.
Mathieu
------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Scikit-learn-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general