How to treat Compass data in random forest regression

I'm working on a project where two of the features are entryHeading and exitHeading. Both state the direction (N, NE, E, SE, S, SW, W) of a vehicle at multiple points. My question is how would i go about pre-processing this? My first thought would be to circularize it like I would a 24 hour period but I'm not sure I should go about it in the same way. The data will eventually be used to train a Random forest regression

Topic preprocessing

Category Data Science


One option is to map the ordinal categories to numerical degrees. This would allow the machine learning model to learn the relative relationships. The machine learning model might interpolate values which may or may not be useful.

One common mapping is:

n  ->   0  
ne ->  45  
e  ->  90  
se -> 135  
s  -> 180  
sw -> 215  
w  -> 270  

The book "Statistical Analysis of Circular Data" by Fisher goes into greater detail about more options.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.