【发布时间】:2020-05-11 19:54:39
【问题描述】:
sklearn.LabelEncoder 的docs 以
开头这个转换器应该用于编码目标值,即 y,而不是输入 X。
这是为什么?
我只发布了这个建议在实践中被忽略的一个例子,尽管似乎还有更多。 https://www.kaggle.com/matleonard/feature-generation 包含
#(ks is the input data)
# Label encoding
cat_features = ['category', 'currency', 'country']
encoder = LabelEncoder()
encoded = ks[cat_features].apply(encoder.fit_transform)
【问题讨论】:
标签: python sklearn-pandas feature-engineering