3
$\begingroup$

So I have a regression problem with bunch of features X, and labels in the amount (price $). How can I convert it to classification problem? I have read about convert label from continuous to categorical possibly thesholding at some points for instance 0-50 (0 class) 51-100 (1 class) and so on till 500 maybe (here thresh-holding to 50). This approach is ineffective intuitively i.e no data lay 51-100. Is there any way to mitigate this problem or if there is any effective way to do this? Like in clustering we can use density estimation can we do that here?

$\endgroup$
2
  • $\begingroup$ You want convert task of predicting the price into a classification task? $\endgroup$
    – skrrrt
    Commented Jul 29, 2020 at 6:22
  • 1
    $\begingroup$ There is no standard method, one can always turn regression into classification using a bunch of different criteria and heuristics. It depends on your data and problem at hand $\endgroup$
    – Nikos M.
    Commented Jul 29, 2020 at 6:54

3 Answers 3

3
$\begingroup$

To add to the number of methods you can use to convert your regression problem into a classification problem, you can use discretised percentiles to define categories instead of numerical values. For example, from this you can then predict if the price is in the top 10th (20th, 30th, etc.) percentile. These values you can easily find out using Python's numpy.percentile(X[i], percentile) method, for example.

This type of labelling will place thresholds with respect to the distribution of the data.

$\endgroup$
3
$\begingroup$

The task you are converting is not actually classification per se, it's ordinal classification. I am pointing this out cause there are implementations that specialise in this matter. Moreover, the task you are asking is how to properly bin the values. For that, you can refer to binning as a pre-processing step. I am sure if you search for "binning python" for instance, you will find various implementations.

$\endgroup$
1
$\begingroup$

Since your output is one dimensional, clustering the output is equivalent to fixing thresholds. The best you can do is use field knowledge to distinguish the different classes. You can also plot the histogram of the log of your price and see if there is a mixture of gaussians and try to seperate them into classes.

$\endgroup$
2
  • $\begingroup$ Can you elaborate on how to separate gaussian mixtures , there is GMM model but that is used for other purposes $\endgroup$ Commented Jul 29, 2020 at 9:33
  • $\begingroup$ Actually, you seperate them by visualising the graph and fixing the thresholds by yourself. It's a one dimensional problem so you're probably more fitted than an unsupervised ML method to fix the thresholds. $\endgroup$
    – mirimo
    Commented Jul 29, 2020 at 9:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.