How to know when to treat a problem as a classification task or a regression task? Facing this dataset: https://archive.ics.uci.edu/ml/datasets/wine+quality I treated it both as a classification task and as a regression task.

Due to the fact that classifying the quality of a wine as 8 while it is a 3 is a huge difference while classifying a 5 as 6 is not that bad

This has two subquestions:


Is there an easy way to change the weight of the classification in a (scikit-learn) classifier?
Following the regression approach and having the output being rounded to the nearest valid wine quality value (converting the outputs to a classifier-like outputs) hides any pitfalls?


Many thanks
In effect it is ordinal regression/classification. I suggest you to go for Mean Absolute Error to take into account the missclassification that play a bigger role when far from the ground truth :

$MAE = \frac{\sum_{i=1}^n|h(x_i) - y_i|}{n}$, creating your own scoring function in python.

Given the number of different outputs you have, I recommend you to go for regression. Anyway, rounding any hypothesis output would only play on the score, it's up to you to decide if it makes more sense to see wine quality scores as classes or not.