https://github.com/szilard/benchm-ml/issues/1

glouppe commented on 7 May 2015

Thanks for the benchmarks! Proper handling of categorical variables is not an easy issue anyway.

I would expect faster, lower memory but decrease in AUC (or same in some cases).

When the categories are ordered, it makes more sense indeed to handle them as numerical variables. I dont have a strong argument as to why it may be also better when there is no natural ordering. I guess it could boil down to the fact that one-hot encoding splits are often very unbalanced, while integer encoded splits may be less unbalanced.

Thanks @glouppe. I read somewhere a paper that AFAIR suggested to sort the (non-ordered) categoricals in order of their frequency in the data and encode them as integers as such. Any idea what that paper might be?

glouppe commented on 7 May 2015

Yes, it is Breiman's book :) When your output is binary, this strategy is in fact optimal (it will find the best subset among the values of the categorical variables) and linear.

See section 3.6.3.2 of my thesis if you dont have the CART book.
http://orbi.ulg.ac.be/bitstream/2268/170309/1/thesis.pdf

One-hot encoding could be helpful when the number of categories are small( in level of 10 to 100). In such case one-hot encoding can discover interesting interactions like (gender=male) AND (job = teacher).

While ordering them makes it harder to be discovered(need two split on job). However, indeed there is not a unified way handling categorical features in trees, and usually what tree was really good at was ordered continuous features anyway..

 
 

 

integer encoding vs 1-hot (py)的更多相关文章

  1. [已解决]关于python无法显示中文的问题:SyntaxError: Non-ASCII character '\xe4' in file test.py on line 3, but no encoding declared。

    想在python代码中输出汉字.但是老是出现SyntaxError: Non-ASCII character '\xe4' in file test.py on line , but no encod ...

  2. 关于python无法显示中文的问题:SyntaxError: Non-ASCII character '\xe4' in file test.py on line 3, but no encoding declared。

    [已解决]关于python无法显示中文的问题:SyntaxError: Non-ASCII character '\xe4' in file test.py on line 3, but no enc ...

  3. requests之headers 'Content-Type': 'text/html'误判encoding为'ISO-8859-1'导致中文text解码错误

    0. requests不设置UA 访问baidu 得到 r.headers['Content-Type'] 是text/html  使用chrome UA: Content-Type:text/htm ...

  4. leetCode练题——13. Roman to Integer

    1.题目13. Roman to Integer Roman numerals are represented by seven different symbols: I, V, X, L, C, D ...

  5. 【论文考古】量化SGD QSGD: Communication-Efficient SGD via Gradient Quantization and Encoding

    D. Alistarh, D. Grubic, J. Li, R. Tomioka, and M. Vojnovic, "QSGD: Communication-Efficient SGD ...

  6. Python函数信息

    Python函数func的信息可以通过func.func_*和func.func_code来获取 一.先看看它们的应用吧: 1.获取原函数名称: 1 >>> def yes():pa ...

  7. Scrapy学习-23-分布式爬虫

    scrapy-redis分布式爬虫 分布式需要解决的问题 request队列集中管理 去重集中管理 存储管理   使用scrapy-redis实现分布式爬虫 github开源项目: https://g ...

  8. Flask入门系列(转载)

    一.入门系列: Flask入门系列(一)–Hello World 项目开发中,经常要写一些小系统来辅助,比如监控系统,配置系统等等.用传统的Java写,太笨重了,连PHP都嫌麻烦.一直在寻找一个轻量级 ...

  9. 使用Java将搜狗词库文件(文件后缀为.scel)转为.txt文件

    要做一个根据词库进行筛选主要词汇的功能,去搜狗下载专业词汇词库时,发现是.scel文件,且通过转换工具(http://tools.bugscaner.com/sceltotxt/)转换为txt时报错如 ...

随机推荐

  1. 数据分析笔试-sql

    题目说明及要求: 以下是模似数据库里的表单信息,请根据要求写出SQL语句 表1:职工信息 表结构如下: 表名:Employee 职工ID   职工姓名       入职年份       部门ID A1 ...

  2. 洛谷 P3015 [USACO11FEB]最好的括号Best Parenthesis

    传送门 题目大意:给出括号的得分标准. ()得分为1,如果A的得分为S(A),那么 (A)的得分为2*S(A). 题解:搜索 #include<iostream> #include< ...

  3. 小程序WXML基本使用

    数据绑定 <!--wxml--> <view> {{message}} </view> // page.js Page({ data: { message: 'He ...

  4. Spring MVC启动时初始化的几个常用方法

    Spring-MVC的应用中,要实现类似的功能,主要是通过实现下面这些接口(任选一,至少一个即可) 一.ApplicationContextAware接口 +? 1 2 3 4 5 6 7 8 9 p ...

  5. maven(基础介绍一)

    maven:提供的作用有以下几点: 1 jar包依赖 这个也许会maven最突出的特点了使用maven不需要上网单独下载jar包,只需要在配置文件pom.xml中配置jar包的依赖关系,就可以自动的下 ...

  6. Linux - 归档和压缩

    归档 归档就是将多个文件或目录合并成一个文件 归档的目的就是方便备份.还原及文件的传输操作 tar 命令:将多个文件或目录归档到一个文件中,可以根据需要只还原归档文件中的某些指定的文件 c:创建,v: ...

  7. ceph 创建和删除osd

    ceph 创建和删除osd 1.概述         本次主要是使用ceph-deploy工具和使用ceph的相关命令实现在主机上指定磁盘创建和删除osd,本次以主机172.16.1.96(主机名ha ...

  8. vue-cli脚手架config目录下index.js配置文件详解

    此文章介绍vue-cli脚手架config目录下index.js配置文件 此配置文件是用来定义开发环境和生产环境中所需要的参数 关于注释 当涉及到较复杂的解释我将通过标识的方式(如(1))将解释写到单 ...

  9. 2014.8.27 Vs2005宏的使用

    终于知道怎么像在Word里那样使用宏了! 1.vs2005必须装补丁1 2.在C:\Program Files (x86)\Common Files\microsoft shared\VSA\8.0\ ...

  10. pl/sql的to_char和to_date

    今天同事让笔者将sql查询出来的时间转换为指定格式的字符串,笔者当时懵逼了,印象中记得有处理过,但就是一时想不起来了,等处理了这个问题后,笔者觉得有必要记录一下,毕竟不知道这个是很掉面子的事不是?好了 ...