0
$\begingroup$

Machine Learning Problem : I have a doubt in one of my feature which has an categorical value 1. One way of dealing with it would be like converting those values into numbers means in ordinal form. But the problem with this would be my model could have learned the relation as 1<2<3 which is not true in terms of categorical values 2. Other way would be converting values into one hot encoding but it could increase the dementionality and can make my data very sparse So how to deal with that type of problem?

Some of people said to use model like xgboost which handles the categorical values but how they internally tackle that?

$\endgroup$
  • $\begingroup$ Tell us, please, why this is a prob!em: memory? Use sparse matrices. To many parameters to learn? Maybe some variant of lasso. Other?? And: most importantly: what do you want to do with your data?? $\endgroup$ – kjetil b halvorsen Sep 7 '18 at 5:07
  • 1
    $\begingroup$ Yes memory is a problem and i also want to use it as its an important parameter for judgement $\endgroup$ – Ajay Sep 7 '18 at 5:37
  • $\begingroup$ Then you can look into sparse matrix representation of your data. Tosay more we really need to know your goal. Is this a regression problem? $\endgroup$ – kjetil b halvorsen Sep 7 '18 at 5:41
  • $\begingroup$ Its an classification problem $\endgroup$ – Ajay Sep 7 '18 at 5:42
  • $\begingroup$ How many classes? $\endgroup$ – kjetil b halvorsen Sep 7 '18 at 5:43
0
$\begingroup$

After you have given some extra information in comments this is approaching an answerable question. You should really edit that extra information into your question (many will not read comments). And, read How to ask a statistics question . Context is essential in statistics, so what do your two classes represent? How many examples? ...

A classification problem with two classes can often be better represented as a logistic regression. Then you get predicted probability for the two classes, and this can later be used to obtain a classification. Frank Harrell has written about that, Choosing between logistic and discriminant, Why isn't Logistic Regression called Logistic Classification?

Then the memory problem (but it could well be a fitting/inference problem too: to estimate 10000+ parameters you need a really big sample). Look at the post Principled way of collapsing categorical variables with many levels? and search this site for the tag many-categories

Software: glmnet implements lasso for logistic regression (among other things), and uses sparse matrices out of the box. Try it!

$\endgroup$

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.