2013/3/27 Anne Dwyer <[email protected]>:
> I'm trying to convert categorical data to input data for an SVM. I am trying
> to transform the data first to label encoded data, then use the one hot
> encoding procedure.
>
> Can some please explain what I am doing wrong?

LabelEncoder is for class labels, not features. If you do want to use
it, you need one encoder per column, but you're probably better off
using numpy.unique with return_inverse=True (again, once per column)
followed by a OneHotEncoder.

You can also use a DictVectorizer if you don't mind getting some
superfluous columns.

-- 
Lars Buitinck
Scientific programmer, ILPS
University of Amsterdam

------------------------------------------------------------------------------
Own the Future-Intel&reg; Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest.
Compete for recognition, cash, and the chance to get your game 
on Steam. $5K grand prize plus 10 genre and skill prizes. 
Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d
_______________________________________________
Scikit-learn-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

Reply via email to