I've been working a little with weka and so far I haven't made my own database to apply a classifier but I've tried to look at the already existing files and from what I've seen there is absolutely no problem with using a mix of categorical and numeric variables and then applying a classifier but I got so confused because while reading a couple of blog posts I saw people converting categorical data to numeric so they can have a homogeneous numeric set of samples.

Is that necessary? Is it preferable? Does it depend on the samples? Does it depend on the algorithm?

Because in my case, one of my input features is user-activity and its values are "walking" "still" "running" "in vehicle" etc... I was thinking of leaving that variable as it is but now I'm wondering should I convert "still" into 0, "walking" into 1 etc...? notice that I'm thinking about applying naive bayes, svm, knn, logistic regression, neural network, random forests (try all of them and see what algorithm provides better accuracy)


It appears that you have a lot of background reading to do. First, it is not usually appropriate to develop classifiers because this involves using an arbitrary loss/utility/cost function. It is usually better to develop a probability estimator (this is what logistic regression does). For details see Classification vs. Prediction | Statistical Thinking. Second, categorical predictors that are not ordinal should be treated as such in any method. In regression this is done by creating $k$ indicator variables for $k$ mutually exclusive categories. This may also be done for ordinal predictors when there are not many levels. For some ordinal predictors for which you can assume roughly equal spacing in the meaning of the values of the predictor, treating it as numeric can work.

  • $\begingroup$ It seems that I really do have a lot more to read. I think despite all the reading I've done so far, I'm misunderstanding a lot of concepts. Thank you for pointing me in the right direction. $\endgroup$ Apr 8 '17 at 12:38
  • $\begingroup$ So far, I've thought logistic regression is a classifier so you saying "it's better to develop a probability estimator (like logistic regression) over a classifier makes me a bit confused but I'm going to read more about it to understand the difference. $\endgroup$ Apr 8 '17 at 12:42
  • 1
    $\begingroup$ Read the link I provided above. Logistic regression is not a classifier, thank goodness. $\endgroup$ Apr 8 '17 at 13:52
  • $\begingroup$ thank you sir for the link, it is most helpful and I'm already understanding a lot more as I'm reading it. $\endgroup$ Apr 8 '17 at 13:58

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.