how to encode classes so that they reflect sequential correlation between them I have a time series that I want to predict (using Neural Network, but is not important). 
On top of using the info at previous values ($t-1$, $t-2$, ...etc) I want to use another variable: the hour of the day.
Stupid Method
One way would be to map:
$00:00 \rightarrow 0 $
$01:00 \rightarrow 1$
....
and so on. So I woul have $24$ classes $\{0,1,2,..., 23\}$. However there is a problem: $23$ and $0$ are close, but at the same time this is not reflected here.
second method: one hot encoding?
Another way would be to create vectors with $24$ entries where all the elements are zero, apart from the class that we are looking at. This is equivalent to creating dummy variables. For instance:
$00:00 \rightarrow [1,0,0,0,....,0]$
$01:00 \rightarrow [0,1,0,0,...,0]$
...and so on. However there is a problem: this doesn not reflect correlation at all!
Other Method
I was thinking of using some cyclic structure, for instance $sin$, $cos$ or maybe polar coordinates?
I haven't found the solution yet, but this is my progress:


*

*Map the class labels of the stupid method to $[0,1]$, by normalizing them

*Scale them to be in the range from $0$ to $2\pi$.

*Use $cos$ or $sin$ on them.


This method doesn't quite work, but I can see some light.. Any ideas?
 A: What you're basically trying to do is convert your dataset from a time-like structure to a feature-like one. I once tried to do the same with random forest, i.e. add extra features on top of lagged terms as inputs. I tried several different things, notably ways of detecting seasonality, cyclicity, and trend, and then transforming them into features (I was successful only to some extent). 
With neural networks, however, you don't need to do any of those things. As described in this book chapter (and as I have experienced myself), neural network autoregression works quite well without adding any extra time-based features on top of lagged variables. As explained in section "neural network autoregression", this method can be efficient without any time-based features because it emulates a nonparametric $AR(p)$ model (or a $ARIMA(p,0,0)$), therefore the time-dependent information is extracted from the lagged terms alone. For a network of $p$ lagged input variables, $m$ hidden neurons in a single hidden layer, and the identity activation function $g(x) = x$, you get a model like this:
$$\hat y_t = w_0 + (\sum_i^m w_i ) \sum_k^p w_k y_{t-k} $$
Which is, well, equivalent to an $AR(p)$ or $ARIMA(p,0,0)$ process of the form:
$$ \hat y_t = c+ \sum_k^p \phi_k y_{t-k}  $$
I should probably also point out that the implementation described in the book applies forecast aggregation (trains multiple networks and averages their prediction). If you want something more "advanced" with a single neural network, you should look into LSTM Networks.
With your methods you're increasing computational complexity without any guaranteed payoff, and that's never a good thing.
