Use heading in Neural Network model I am working on a prediction model where I must find out the destination of a boat based on its actual coordinates and heading (compass direction) :
In[8]: X.head()
Out[8]: 
   latitude  longitude     heading
0  0.094700   0.094700  332.398791
1  0.090828   0.090828  197.320172
2  0.085800   0.085800  140.537550
3  0.081676   0.081676  128.891893
4  0.077804   0.077804  129.881418

Latitude and longitude are in degrees (normalised here) and heading is in degrees.
The output variable is an integer between 1 and n (there are n possible destinations).
My problem here is to make the neural network understand how heading difference works : 5 degrees and 15 degrees are as close as 5 degrees and 355 degrees because we have to use a modulo 360 after making the difference :
In[11]: diff_heading(355, 5)
Out[11]: 10
In[12]: diff_heading(15, 5)
Out[12]: 10

I've got some acceptable results when I put the coordinates and heading in a basic multilayer perceptron neural network without any preprocessing on the heading. But I'm pretty sure it could be way more better if the network could take into account this heading problem. For now, the network must attribute weights to the heading which indicate that 0 and 360 degrees are opposite, which is false.
Do you have any idea on how to process the data or how to change the network structure to achieve this ?
You could break the heading ($\theta$) into components: $sin(\theta)$ and $cos(\theta)$, which would remove the modulo problem.