1.将离散变量进行ONE-HOT编码
在作为示例的租房数据中,分类变量 neighborhood 可以对应三个值:运用 Scikit-Learn 中的 DictVectorizer 函数,我们将以上租房数据的分类变量转换为 one-hot 形式
one-hot编码
可以通过调用 getfeaturenames 函数,来查看转换后的数组中对应的列名:
要注意的是,当我们将 DictVectorizer 函数参数 sparse 的值设置为 True 时,转换后的对象将不再是一个数组,而是一个 sparse matrix 对象
参考地址:https://www.cnblogs.com/jasonfreak/p/5448385.html
https://www.cnblogs.com/5poi/p/7240601.html
http://makaidong.com/yifdu25/90162_16542816.html
https://blog.csdn.net/wizardforcel/article/details/54177960
kaggle:
https://blog.csdn.net/Koala_Tree/article/details/78725881
https://blog.csdn.net/guoxinian/article/details/73740746
学习资料:
https://download.csdn.net/download/qq_21578125/10353963
https://blog.csdn.net/u012448083/article/details/57419723
https://blog.csdn.net/qq_26898461/article/details/49275401
https://blog.csdn.net/starzhou/article/details/73930150
https://blog.csdn.net/Koala_Tree/article/details/78725881
https://blog.csdn.net/hermito/article/details/51862733
https://blog.csdn.net/jdbc/article/details/72468001
https://blog.csdn.net/qq_33614902/article/details/80712348
https://blog.csdn.net/levy_cui/article/details/72831001