I would like to implement a machine learning procedure, in order to predict a categorical binary outcome. However, my main concern, is the different "nature" of my features: while a proportion of my features have discrete binary values, such as "yes" or "no", the others are essentially continuous numeric variables. Thus, as im mainly working in R, is there a package or methodology that can handle both "types" of features into training a classifier ? or i have to separare my data set into two datasets, each comprised of the different type of features ?

  • 1
    $\begingroup$ Logistic regression, SVM, random forest, neural networks, Naive Bayes, Cubist, gmb, xgboost and many more are all capable of doing this. $\endgroup$ – Sycorax Mar 31 '16 at 21:55
  • $\begingroup$ Dear user777 thank you for your answer !! Actually, i didn't knew that gmb (perhaps you meant gbm?) or random forests could handle not only continuous variables of different "nature", but also different "types" of features. In your opinion, also a transformation on the data would be also essential ? especially for the continuous ones ? $\endgroup$ – Jason Mar 31 '16 at 22:01

You can have both continuous and binary values when making a classifier. You're model will have what is known as dummy variables in it. As a first pass, I would give a go at logistic regression, but there are many, many different types of ways to do this.

Let's say you had a problem wanting to predict if someone will vote (so your binary outcomes) and you have two features: gender and income. In r you would try something like:

logistic_model = glm(Vote ~ Income + Gender, family=binomial, data=mydataset)

  • $\begingroup$ Dear dmb, thank you for your answer and example !! Actually, i also might try different types of models, like the logistic regression you meant above, or ensemble models. One crusial question: due to the different nature of variables, does a tranformation be essential ? or due to the "dummy " variables you mentioned, it would not be appropriate? $\endgroup$ – Jason Mar 31 '16 at 22:10

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.