0
$\begingroup$

I have a dataset consisting of ~20000 lines and 8 columns. It is a mixture of binary and float data, but one binary variable is the important one and I want to create a model to predict the other variables based on this binary.

What confuses me is the mix of binary and float data in order to select the best method. I assume the size of 20000 lines means it can be classified as a relatively small sample.

I just want a breakthrough how everyone thinks in order to find the best method(s). I am thinking that classification methods such as SVC should be working best, based on the scikit-learn algorithm cheet-sheet. I am using Python for this. I am using Python for this.

Many thanks for your help and guidance! I am new to the field of data science, and am eager to go deeper into this amazing field.

$\endgroup$
1
$\begingroup$

To answer your question, let's first put things into proper terms:

I have a dataset consisting of ~20000 lines and 8 columns. It is a mixture of binary and float data

You have a dataset with ~20,000 observations, or instances, and 8 variables. These variables are of mixed types: numeric/continuous, and categorical/discrete.

one binary variable is the important one and I want to create a model to predict the other variables based on this binary.

One of your binary variables is the classification (i.e. yes/no, positive/negative) that you are ultimately interested in. This is your response. You want to model the rest of your data as regarding that variable, so that (1) given the other seven variables, you can predict the classification of this instance, and (2) given the classification of an instance, you can perhaps make assumptions about average values for the other variables. These other variables are your predictors.

This is a basic outline of a binary classification problem.

What confuses me is the mix of binary and float data in order to select the best method.

There are many different classifiers. The question that you need to consider for each is: how does this method handle continuous data, and how does this method handle categorical data?

Most classifiers have no problem with continuous data. Even decision trees, which intuitively work best with categorical variables, can smoothly implement 'under the hood' mechanisms to handle continuous variables. So the real question is: how does this algorithm handle categorical variables?

Logistic regression, a simple binary classifier, can handle your categorical data by creating 'dummy variables' for each category. A dummy variable is also called an indicator variable, and it takes on the value of either 1 or 0 to indicate the presence of a specific categorical value. For example, suppose you have a categorical variable, Gender. The values for this variable can be male, or female. A dummy variable for this can be Male. If the value of Gender is indeed male, then this dummy Male variable will have the value 1. Otherwise, it will be 0. By using dummy variables, categorical values can easily be represented and modeled in logistic regression. While it's important for you to understand how dummy variables work, most statistical software and languages provide 'assistance' for this. In python, for example, you can use pandas's get_dummies function to create those dummy variables for you.

Here is a great tutorial demonstrating logistic regression in python, that specifically explores the usage of dummy variables. http://blog.yhat.com/posts/logistic-regression-python-rodeo.html

Good luck!

$\endgroup$
2
  • $\begingroup$ Thank you for your very detailed reply Miriam! If I understand you right, your suggestion would be to use Logistic regression, right? But as far as I see it, it can only take one predictor at a time, not all 7 of them. So I would need to run this regression for each of the predictors? I take it then that the only reason I am not using different classifiers is that I want a consistency between the results of the different predictors? $\endgroup$
    – Tobias
    Nov 8 '16 at 12:53
  • $\begingroup$ Happy to help. Logistic regression can definitely use all your predictors at once - what makes you think not? As far as using different classifiers - can you explain what you mean? It's always nice to play around with different classifiers and see which one performs best. Logistic regression was just the simplest one for this problem, to my mind. $\endgroup$
    – mker
    Nov 11 '16 at 4:12

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.