Im working on a classification class, where I want to predict the occurrence of a specific event. That is, does the event occur in the next 6 hours, 12 hours or 24 hours? Using softmax here seems not fully meaningful, as a high probability of first class (6 hours) also implies that the condition occur in 12 hours and 24 hours. So is there a good activation function for that?
1 Answers
You're correct that softmax & classification are not an appropriate way to approach the problem. Your outcome is not an unordered category, it's a positive real number.
Predicting a continuous outcome is a regression task. ReLU, ELU and softplus are all examples of non-negative real activation functions; square error loss will probably work well enough.
An alternative approach would be to assume that the conditional outcome follows some probability distribution, so the task of the model is to estimate the parameters of that distribution. Here's an outline of how this works: How to construct a cross-entropy loss for general regression targets?
In comments, OP clarifies that they have some events that haven't occurred by the time the study period has ended. This is the core problem that survival analysis aims to solve!
- 90,934
-
What you pointed out seems quite fair to me. However, a drawback with using regression is how to handle time series where the event does simply Not occur. Just using a high number like 1000 as a ground truth label seems a bit arbitrary , isn't? – f_3464gh Aug 19 '22 at 14:43
-
1This is the core problem that [tag:survival] analysis aims to solve! Basically, your data collecting process exhibits [tag:censoring], where the event of interest has not occurred by the end of the study period. While it would be more informative if you knew the exact value of the time the event occurred, you still know that the event took at least as long as the study period to happen, so an appropriate model can incorporate that information. – Sycorax Aug 19 '22 at 14:49