Tree-based Model 如何处理categorical variable
categorical variable 分为 order variale 和 non-order variable,其中order variable直接使用sklearn.preprocess.LabelEncoder是最好的处理方法。对于order variable的处理方法主要在于是否使用one-hot encoding。在这篇quora answer (author: Clem Wang)中给出了其它的处理方法:
One can try a few other approaches:
- look at how the response variable responds to the categorical values and try to group them.
- Find another ML algorithm that works better with categorical features or with one-hot encoding and use that to train a submodel that just uses the categorical features. Then replace the categorical feature with a probability score. For instance, use a Logistic Regression on the hot-encoded values.
- Try to combine the categorical feature with some other features.
- Build N xgboost classifiers, one for each category.
This may require playing around with the data a bit. Plotting the data may help you see patterns that you didn't know that were there.
这篇博客对于在xgboost中使用one-hot给出了一个总体结论:
总结起来的结论,大至两条:
- 1.对于类别有序的类别型变量,比如age等,当成数值型变量处理可以的。对于非类别有序的类别型变量,推荐one-hot。但是one-hot会增加内存开销以及训练时间开销。
- 2.类别型变量在范围较小时(tqchen给出的是[10,100]范围内)推荐使用
其他相关的资料
comment:re sklearn -- integer encoding vs 1-hot
Tree-based Model 如何处理categorical variable的更多相关文章
- A Complete Tutorial on Tree Based Modeling from Scratch (in R & Python)
A Complete Tutorial on Tree Based Modeling from Scratch (in R & Python) MACHINE LEARNING PYTHON ...
- 10X genomics|cell base|in-vivo based|model organisms|SBI|
生命组学-药物基因组学 精准医学的内容有个人全基因组测序,移动可穿戴设备,它可以实时监测,深度学习模型预测疾病,对疾病预测做到有效.安全和可控. 药物基因组学就是研究疾病.化合物和靶点之间的关系,关键 ...
- 含有分类变量(categorical variable)的逻辑回归(logistic regression)中虚拟变量(哑变量,dummy variable)的理解
版权声明:本文为博主原创文章,博客地址:,欢迎大家相互转载交流. 使用R语言做逻辑回归的时候,当自变量中有分类变量(大于两个)的时候,对于回归模型的结果有一点困惑,搜索相关知识发现不少人也有相同的疑问 ...
- QT目录模型QDirModel的使用(一个model同时连接tree,list,table)
3#include <QApplication>#include <QAbstractItemModel>#include <QAbstractItemView># ...
- Spark MLlib - Decision Tree源码分析
http://spark.apache.org/docs/latest/mllib-decision-tree.html 以决策树作为开始,因为简单,而且也比较容易用到,当前的boosting或ran ...
- (转)Decision Tree
Decision Tree:Analysis 大家有没有玩过猜猜看(Twenty Questions)的游戏?我在心里想一件物体,你可以用一些问题来确定我心里想的这个物体:如是不是植物?是否会飞?能游 ...
- Physically Based Shader Development for Unity 2017 Develop Custom Lighting Systems (Claudia Doppioslash 著)
http://www.doppioslash.com/ https://github.com/Apress/physically-based-shader-dev-for-unity-2017 Par ...
- Codeforces 379F New Year Tree
F. New Year Tree time limit per test2 seconds memory limit per test256 megabytes You are a programme ...
- 谣言检测()——《Debunking Rumors on Twitter with Tree Transformer》
论文信息 论文标题:Debunking Rumors on Twitter with Tree Transformer论文作者:Jing Ma.Wei Gao论文来源:2020,COLING论文地址: ...
随机推荐
- c#中异常捕获,回滚
语法: try { 有可能出现错误的代码写在这里 } catch { 出错后的处理 } 如果try中的代码没有出错,则程序正常运行try中的内容后,不会执行catch中的内容, 如果try中的代码一但 ...
- 解决tomcat端口冲突
1.根据8080端口号查找占用8080端口的进程 netstat -ano|findstr " 进程id:6352 2.根据进程ID查找进程名字 tasklist|findstr " ...
- css 字体库和动画
@font-face { font-family:'WebSymbols'; src: url('../font/WebSymbols-Regular.otf'); } .icon{ font-fam ...
- 【题解】P3391 文艺平衡树
用pb_ds库中的rope水过去的,忽然发现这玩意能水好多模拟题. 详见这个博客:背景的小姐姐真的好看 声明 #include <ext/rope> using namespace __g ...
- python 列表反转
反转: 将原列表反转,返回None: li = [1, 2, 3]li.reverse()print(li)# [3, 2, 1]1234不改变原列表,返回反转后的新列表: li = [1, 2, 3 ...
- 帝国cms 此栏目暂无任何新增信息处理办法
在做一个新网站的时候不能保证每个栏目都能填充内容,当某个栏目没有内容填充的时候总会出现“此栏目暂无任何新增信息”看着挺不舒服. 其实想删除这行字也挺简单,只需要修改下语言包即可!如下: 找到语言包文件 ...
- vccode配合svn
先安装插件 要实现版本对比.需要先安装svn服务端 vue插件 微信小程序插件
- 【1】Zookeeper概述
一.前言 在"网络是不可靠的"这一前提下,分布式系统开发需要解决如下四个问题: 客户端如何访问众多服务? 解决方案:服务聚合,使用API网关 服务于服务之间如何通信? 解决方案 ...
- [转] TextCNN调参技巧
原文地址: https://plushunter.github.io/2018/02/26/%E8%87%AA%E7%84%B6%E8%AF%AD%E8%A8%80%E5%A4%84%E7%90%86 ...
- 分享一个百万数量级的测试学习用的mysql数据集
TEST_DB 带有集成测试套件的示例数据库,用于测试应用程序和数据库服务器 此存储库已从Launchpad迁移. 请参阅MySQL文档中的用法 它来自哪里 原始数据由西门子企业研究中心的Fushen ...