How to deal with an SVM with categorical attributes?

原文链接:http://stats.stackexchange.com/questions/52915/how-to-deal-with-an-svm-with-categorical-attributes

Q:

I have a space of 35 dimensions (attributes). My analytic problem is a simple classification one.

Out of 35 dimensions, more than 25 are categorical and each attribute takes more than 50+ types of values.

In that scenario, introducing a dummy variable also will not work for me.

How can I run an SVM on a space which has a lot of categorical attributes?

A:

  1. If you are sure the categorical attribute is actually ordinal, then just treat it as numerical attribute.
  2. If not, use some coding trick to turn it into numerical attribute. According to the suggestion by the author of libsvm, one can simply use 1-of-K coding. For instance, suppose a 1-dimensional category attribute taking value from  {A,B,C} . Just turn it into 3-dimensional numbers such that  A=(1,0,0) B=(0,1,0) C=(0,0,1) . Of course, this will incur significantly additional dimensions in your problem, but I think that is not a serious problem for modern SVM solver (no matter Linear type or Kernel type you adopt).

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值