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的更多相关文章

  1. 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  ...

  2. 10X genomics|cell base|in-vivo based|model organisms|SBI|

    生命组学-药物基因组学 精准医学的内容有个人全基因组测序,移动可穿戴设备,它可以实时监测,深度学习模型预测疾病,对疾病预测做到有效.安全和可控. 药物基因组学就是研究疾病.化合物和靶点之间的关系,关键 ...

  3. 含有分类变量(categorical variable)的逻辑回归(logistic regression)中虚拟变量(哑变量,dummy variable)的理解

    版权声明:本文为博主原创文章,博客地址:,欢迎大家相互转载交流. 使用R语言做逻辑回归的时候,当自变量中有分类变量(大于两个)的时候,对于回归模型的结果有一点困惑,搜索相关知识发现不少人也有相同的疑问 ...

  4. QT目录模型QDirModel的使用(一个model同时连接tree,list,table)

    3#include <QApplication>#include <QAbstractItemModel>#include <QAbstractItemView># ...

  5. Spark MLlib - Decision Tree源码分析

    http://spark.apache.org/docs/latest/mllib-decision-tree.html 以决策树作为开始,因为简单,而且也比较容易用到,当前的boosting或ran ...

  6. (转)Decision Tree

    Decision Tree:Analysis 大家有没有玩过猜猜看(Twenty Questions)的游戏?我在心里想一件物体,你可以用一些问题来确定我心里想的这个物体:如是不是植物?是否会飞?能游 ...

  7. 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 ...

  8. Codeforces 379F New Year Tree

    F. New Year Tree time limit per test2 seconds memory limit per test256 megabytes You are a programme ...

  9. 谣言检测()——《Debunking Rumors on Twitter with Tree Transformer》

    论文信息 论文标题:Debunking Rumors on Twitter with Tree Transformer论文作者:Jing Ma.Wei Gao论文来源:2020,COLING论文地址: ...

随机推荐

  1. Java Jersey的详情概述

    Jersey是一个RESTFUL请求服务JAVA框架,与常规的JAVA编程使用的struts框架类似,它主要用于处理业务逻辑层. 与springmvc 的区别: 1. jersey同样提供DI,是由g ...

  2. Typora入门:全网最全教程

    目录 简介 Markdown介绍 常用快捷键 块元素 换行符 标题级别 引用文字 无序列表 有序列表 任务列表 代码块 数学表达式 插入表格 脚注 分割线 目录(TOC) 跨度元素 链接 网址 图片 ...

  3. http请求204

    项目中发现一个奇怪的问题,请求的时候同一个接口有两个请求,而且有一个状态为204,有一个为200 在网上查看资料后得知,是因为跨域而引起的,OPTIONS是一种“预检请求”,浏览器在处理跨域访问的请求 ...

  4. 7 java 笔记

    1 方法是类或者对象行为特征的抽象,方法是类或对象最重要的组成部分 2 java里面方法的参数传递方式只有一种:值传递 值传递:就是将实际参数值的复制品传入方法内,而参数本身不会受到任何影响.(这是j ...

  5. 彻底卸载mysql数据库~

    以下操作以win10操作系统为例 1 停止window的MySQL服务 打开此台电脑的管理 ---> 服务和应用程序 --->服务,找到mysql的服务并停止 2 卸载MySQL安装程序 ...

  6. Go语言基础之Cookie和Session

    Cookie和Session Cookie和Session是Web开发绕不开的一个环节,本文介绍了Cookie和Session的原理及在Go语言中如何操作Cookie. Cookie Cookie的由 ...

  7. java开发技巧

    1,IDEA辅助功能Shift +F2去到有错误的地方Alt+Enter,会给出解决错误的建议: 2,调试,没问题的步骤,直接跳过,不要跳入细节: 调试时,要明确要跟踪的变量,不要陷入混乱: 3,调试 ...

  8. 小猿圈-IT自学人的小圈子 https://book.apeland.cn/details/54/

    笔记链接   https://book.apeland.cn/details/54/ 学习视频   https://www.apeland.cn/python

  9. Oracle之:Function :func_float()

    create or replace function func_float(i_value float) return number is v_index number := 0; v_str var ...

  10. 【Eclipse】Macbook eclipse 指定JDK

    1. vi /Applications/eclipse/Eclipse.app/Contents/Eclipse/eclipse.ini 输入 -vm /Library/Java/JavaVirtua ...