I'm using a multi-layer perceptron model to predict the cumulative number of boardings and alightings from a bus travelling on a standard route based on previous cumulative boarding and alighting values and a few other parameters. I have made separate models with each of the two as the label or dependent variable and have got the predictions. But I want to use a constraint such that the predicted alighting values is less than the predicted boarding values at each stage (since the number of people that get off a bus can't be higher than the number of people that got on). I could run the model to predict the boarding values first and then use those predictions as a feature to predict the cumulative alighting values. However, I still can't figure how to implement this constraint. Any suggestions will be really appreciated, thanks.
Asked
Active
Viewed 23 times
0
-
If you predict the current number of people in the bus you can derive boardings and alightings from that number – Firebug Jul 08 '21 at 14:10
-
Very similar question: https://stats.stackexchange.com/questions/463751/loss-function-in-machine-learning-how-to-constrain/463762#463762 – Sycorax Jul 08 '21 at 14:33