总结:
Label Encoding
优点:节约空间
缺点:对同一个特征,每次编码的结果不一样;编码隐含了特征取值的相关关系
OneHot Encoding
优点:避免了LabelEncoding的缺点...
缺点:特征取值多时占用空间较多
使用推荐:
在特征取2值时,使用LabelEncoding。
其他情况用OneHotEncoding,如果转换之后维度过高,后续用PCA或其他降维方法。在保留必要信息的前提下,降低维度。
The problem with label encoding is that it gives the categories an arbitrary ordering. The value assigned to each of the categories is random and does not reflect any inherent aspect of the category. In the example above, programmer recieves a 4 and data scientist a 1, but if we did the same process again, the labels could be reversed or completely different. The actual assignment of th