To make a classification model out of a regression model, you need to first convert the continuous output of the regression model into a categorical output. There are various ways to do so, some of which are mentioned below:
Thresholding: Choose a threshold below which the output is considered negative and above which is positive. This way you can convert the continuous output into binary classes.
Binning: Divide the range of predictions into multiple bins and assign a class label to each of the bins. For example, if the prediction is between 0 and 0.33, assign it class 1, if it is between 0.33 and 0.66, assign it class 2, and so on.
After conversion you can train a classification model(such as Logistic Regression or SVM) on the categorical output using the same input features used for training the regression model.
Here's the sample code for Thresholding:
main.py662 chars21 lines
gistlibby LogSnag