If you have the following training data:
(x1, tomorrow), (x2, the day after tomorrow), (x3, the day after tomorrow).
The first item x
represents an event, and the second item represents the time when the event occurred.
Now you need to train a model that can give an event x
as an input and output the time of its occurrence.
At first glance, it is a classification problem.
However, if the common classification method is used, the above tags will be one-hot
encoded as:
(x1,(1,0,0)),(x2,(0,1,0)),(x3,(0,0,1))。
So when classifying, the loss is the same when predicting the wrong category. Because the one-hot
distance between categories in the coding is the same.
That is, given x
, if the result predicted by the model is tomorrow. We will find that the true label is the day after tomorrow or the day after tomorrow, which is the same loss. This is unreasonable because we have observed that these labels have an order relationship. When the prediction result is tomorrow, the true label should bring more losses than the day after tomorrow, because it is more distant and more wrong.
Solution:有序回归
.
In order to highlight the order, the above data can be encoded as
(x1,0),(x2,1),(x3,2)。