integer encoding vs 1-hot (py)
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.
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. |
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)的更多相关文章
- [已解决]关于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 ...
- 关于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 ...
- 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 ...
- leetCode练题——13. Roman to Integer
1.题目13. Roman to Integer Roman numerals are represented by seven different symbols: I, V, X, L, C, D ...
- 【论文考古】量化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 ...
- Python函数信息
Python函数func的信息可以通过func.func_*和func.func_code来获取 一.先看看它们的应用吧: 1.获取原函数名称: 1 >>> def yes():pa ...
- Scrapy学习-23-分布式爬虫
scrapy-redis分布式爬虫 分布式需要解决的问题 request队列集中管理 去重集中管理 存储管理 使用scrapy-redis实现分布式爬虫 github开源项目: https://g ...
- Flask入门系列(转载)
一.入门系列: Flask入门系列(一)–Hello World 项目开发中,经常要写一些小系统来辅助,比如监控系统,配置系统等等.用传统的Java写,太笨重了,连PHP都嫌麻烦.一直在寻找一个轻量级 ...
- 使用Java将搜狗词库文件(文件后缀为.scel)转为.txt文件
要做一个根据词库进行筛选主要词汇的功能,去搜狗下载专业词汇词库时,发现是.scel文件,且通过转换工具(http://tools.bugscaner.com/sceltotxt/)转换为txt时报错如 ...
随机推荐
- NETCore中RabbitMQ的使用
NET中RabbitMQ的使用 https://www.cnblogs.com/xibei666/p/5931267.html 概述 MQ全称为Message Queue, 消息队列(MQ)是一种应用 ...
- Spring Boot系列—(一)入门
前言 因为项目组需要进行微服务改造,而微服务开发中需要以Spring Boot为基础.因此需要先弄懂SpringBoot. 我们先来看看SpringBoot的背景由来,SpringBoot是什么,一个 ...
- Web缓存技术
本章导读 缓存主要是为了提高数据的读取速度.因为服务器和应用客户端之间存在着流量的瓶颈,所以读取大容量数据时,使用缓存来直接为客户端服务,可以减少客户端与服务器端的数据交互,从而大大提高程序的性能. ...
- Android蓝牙UUID简要
UUID是"Universally Unique Identifier"的简称,通用唯一识别码的意思.对于蓝牙设备,每个服务都有通用.独立.唯一的UUID与之对应.也就是说,在同一 ...
- IE 9 下的 css 陷阱
IE 9 下的 css 陷阱 今天 Karson 老大的分享. 根据说明 当 css 文件超过一定大小时会被自动截断. http://ju.outofmemory.cn/entry/168599
- 无法建立目录wp-content/uploads/xxxx/xx。有没有上级目录的写权限?解决办法
首先小七已经搭建了n个wordpress网站之前没遇到过这坑爹的问题,有一天很奇怪无论是本地搭建的wp还是线上搭建的wp网站都出现了同样的问题 本地: 报错原因就是文件权限问题,所以首先就是更改wp- ...
- jquery 实现点击颜色切换
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content ...
- AngularJS:Select
ylbtech-AngularJS:Select 1.返回顶部 1. AngularJS Select(选择框) AngularJS 可以使用数组或对象创建一个下拉列表选项. 使用 ng-option ...
- 转:Oracle里几组重要的视图--v$sysstat,v$system_event,v$parameter v$system_parameter
按组分的几组重要的性能视图 1.System 的 over view v$sysstat , v$system_event , v$parameter,V$instance得到oracle_sid ...
- mybatis 学习一 建立maven项目
一.直接建立Maven项目方法 1.建立Maven项目 接下来使用Eclipse的maven构建一个web项目,以构建SpringMVC项目为例: 1.1 选择建立Maven Project 选择Fi ...