将大量分类变量编码为输入数据 [英] Encoding large numbers of categorical variables as input data

查看:50
本文介绍了将大量分类变量编码为输入数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在处理数百个类别(例如,列之一为名字"的数据集.编码此类数据的最佳方法是什么?

One hot encoding doesn't sound like a great idea when you're dealing with hundreds of categories e.g. a data set where one of the columns is "first name". What's the best approach to go about encoding this sort of data?

推荐答案

我建议使用哈希技巧:

https://en.wikipedia.org/wiki/Feature_hashing#Feature_vectorization_using_the_hashing_trick

计算便宜,易于使用,允许您指定维数,并且通常用作分类的良好基础.

It's cheap to compute, easy to use, allows you to specify the dimensionality, and often serves as a very good basis for classification.

对于您的特定应用程序,我将对特征/值对(例如('FirstName','John')进行哈希处理,然后增加该哈希值的存储桶.

For your specific application, I would hash feature-value pairs, like ('FirstName','John'), then increment the bucket for the hashed value.

这篇关于将大量分类变量编码为输入数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆