一个完整的机器学习项目中的对文本特征类编码地方问题
LelandYan opened this issue · 0 comments
LelandYan commented
为什么使用sklearn的LabelEncoder()和pandas中的factorize()的结果不同
from sklearn.preprocessing import LabelEncoder
encoder = LabelEncoder()
housing_cat = housing["ocean_proximity"]
housing_cat_encoded1 = encoder.fit_transform(housing_cat)
housing_cat_encoded2, housing_categories = housing_cat.factorize()
housing_cat_encoded1[:10]
housing_cat_encoded2[:10]
为什么housing_cat_encoded1的值0-4, housing_cat_encoded2的值0-2