LSTM predicting expected value and standard deviation with one-hot encoding I am implementing LSTM to a time series prediction which requires predicting both the expected value (i.e. the mean of the prediction), and the standard deviation (i.e. the interval that the future value should fall into).

I have considered that one-hot encoding can return the possibility of the prediction of each category, which can then be used to both find the mean and the S.D. of the prediction, for example if the output of the LSTM is


Category  | Possibility   
[0,5)     |    0.1   
[5,10)    |    0.2
[10,15)   |    0.4   
[15,20)   |    0.3


I then conclude that the expected value of the prediction is
(2.5x0.1 + 7.5x0.2 + 12.5x0.4 + 17.5x0.3 = 12)

and the S.D. is find in the similar manner.

My question is, is this method a valid method to find the mean and the S.D. of the prediction, why / why not?
The standard deviation and mean of a categorical variable is not meaningful. It looks like the original data are from a range of [0, 20), and the space has been discretized. Now, instead of ranges, you have ordered categories 1 through 4. The individual numbers within each category have lost their meaning. For more details, see the accepted answer here