I have a dataset that gives data on infertitlity and causes. The dataset is mainly 0,1 to represent "yes" and "no". However, some fields have "Sometimes", "Often" which would be represented by -1 or 2. I've only learnt how to do categorical data i.e. 1,0 and Numberical data. So my question is since there are more options other than 1 and 0, which type of regression do I use? Logistic regression or Linear regression?
Using Logistic regression or Linear regression depend on the dependent variable(DV). Based on your question, I believe that your DV will be infertitlity(Yes/No) so you should use logistic regression because linear regression is for the continuous variables(e.g:exam score) and logistic regression is for categorical variables(e.g.L Yes/NO)
well ... some points first: Logistic Regression is for classification and Linear Regression is for regression tasks. They are conceptually different so be careful what you want to do.
Categorical variables can be vectorized using encoding. If there are many categories you may apply a dimensionality reduction before feeding the data to the algorithm.
The algorithm is chosen based on a model selection process so, in general, you do not know in advance which one is better.
Choosing the learning algorithm depends on the problem type:
- Linear regression is typically used for regression problems (i.e., predicting results within a continuous output)
- Logistic regression is typically used for classification problems (i.e., predicting results in a discrete output)
In our scenario, we want to predict if patients with certain causes (features) are highly likely to be diagnosed with infertility ("yes"), are often diagnosed with infertility ("often"), are sometimes diagnosed wit infertility ("sometimes"), or are highly likely to be not diagnosed with infertility ("no"). So, as a result, we can have one of the four discrete outputs: "yes", "often", "sometimes", "no". That is, we have a classification problem and therefore we should choose logistic regression over linear regression.
Now, logistic regression does binary classification (two classes) and we have four classes. Still, we can use logistic regression by learning four different models:
- Predicts "yes" or "the rest" ("the rest" includes "often", "sometimes", "no")
- Predicts "often" or "the rest" ("the rest" includes "yes", "sometimes", "no")
- Predicts "sometimes" or "the rest"
- Predicts "no" or "the rest"
For a given patient, all four models are then evaluated. Ideally, three of the models will predict "the rest" and one will predict the actual class for the patient. This strategy is called one-vs.-rest transformation. There is also one-vs.-one transformation.
Alternatively, we can use one of the learning algorithms that natively support multiclass classification and do not require a transformation: decision trees, support vector machines, neural networks, multinomial logistic regression, etc.