I have a dataset which has only categorical values. As I came across a few articles people suggested that KNN / Random forest would work for dataset like this. Though in R it couldn't handle as if contains more than 53 categories.

Whereas in Sklearn, I used linear regression against each column to the column which I was predicting. After which I created a weighted average of all the outputs. But I'm pretty sure it's not the right way.

Can anyone suggest a better way?
PS : The dataset contains 4 columns with only categorical values. With 200 - 250 different categories in each column.

  • $\begingroup$ did you try using scikit-learn.org/stable/modules/generated/… or scikit-learn.org/stable/modules/generated/… ? $\endgroup$ – BrunoGL Jul 22 '18 at 17:05
  • $\begingroup$ you can have a look at datascience.stackexchange.com/a/35646/54395 for some categorical data usage with SKlearn $\endgroup$ – BrunoGL Jul 22 '18 at 17:07
  • $\begingroup$ I saw the post. Will it be any good for a dataset with 4 columns with categorical values. Where each one has 200 - 250 range of categorical data $\endgroup$ – Kabeer Khan Jul 23 '18 at 3:40
  • $\begingroup$ it will work (i.e. run). If it will be any good is up to you. That is the beauty of Data Science: you get to experiment to find out. $\endgroup$ – BrunoGL Jul 23 '18 at 6:52
  • 1
    $\begingroup$ What are you trying to achieve with such data? $\endgroup$ – mapto Jul 23 '18 at 14:22

Welcome to the site!

I think the 53 category issue is specific to R's randomForest package. If you're set on using a random forest, try other packages like ranger and Rborist.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.