I have a set of data points each representing a day and a number of features associated with it: temperature, wind speed, wind direction, humidity... etc. Before the analysis, I am meant to normalise the data, however I have trouble dealing with the "wind direction" feature as it is expressed in degrees. Winds blowing at 1° and 359° are almost identical, yet on a graph they are very far apart from each other.

Could anyone suggest a method to overcome this problem? I was thinking of transforming the "degree" feature to a two dimensional feature of "cos(θ)" and "sin(θ)", however that would mean I would have a 2 dimensional vector instead of 1. Any other suggestions would be appreciated. Thanks!

  • 1
    $\begingroup$ Regression and Correlation of Wind Direction (circular) Data is a closely related question: you might also want to search for "directional statistics" (also known as "circular statistics") on the web or on our site. $\endgroup$ – Silverfish Dec 4 '15 at 21:02
  • 3
    $\begingroup$ 'Normalization' here might be a bit broad, and might be hard to translate to a circular statistics context. What exactly is the goal of your procedure? $\endgroup$ – Kees Mulder Dec 4 '15 at 23:48
  • $\begingroup$ I apologise, I live in the North West of the UK, electricity was cut down due to floods, I was unable to reply earlier. @Silverfish thanks for the link, I am trying to get the book mentioned in one of the posts in that link, thanks! $\endgroup$ – michal111 Dec 8 '15 at 16:47
  • $\begingroup$ @KeesMulder my goal is to perform clustering of points, given different parameters of weather (temperature, humidity, wind speed, wind direction etc). Bclustering itself, data need to be pre-processed (outliers removed). Normalising works fine for all parameters, except wind direction. I am trying to figure out how to include direction in my analysis. $\endgroup$ – michal111 Dec 8 '15 at 16:48
  • 1
    $\begingroup$ Cosine and sine are an excellent choice. Since you already have a multiple-variable situation, adding one more should be of no concern. $\endgroup$ – whuber Dec 11 '15 at 15:21

If you only have wind direction, leave your features as angles and model them using a circular distribution such as the von Mises distribution. If you have wind speed as well, why not model the vector of the wind speed and direction?

What is normalizing meant to fix in this case?


Interesting question. This is just a off-the-cuff thought, I don't have specific experience that would support it, so take my advice without warranty. But my first thought in approaching the problem might be to convert it into a more course grained 1-of-K encoding of features.

For example:

feature 1 = 1 if wind is N  (0 otherwise)
feature 2 = 1 if wind is NE (0 otherwise)
feature 3 = 1 if wind is E  (0 otherwise)
And so on...

I could envision maybe 8 features, if you think fine tuned wind direction is important I could envision upping that to 12 or 16 features.

At least intuitively this makes sense, a warm southerly wind might have different properties than a cold westerly, and this approach would make that distinction easy to learn, and be linearly separable.

The interaction between sin and cos doesn't give me a warm and fuzzy feeling about how well an algorithm might learn from it.

Some concerns about this approach to think about: it might be increasing the dimensionality of the problem causing some unwanted side effects in learning (especially if you have a small data set). It might also eliminate the finer details that are perhaps important to the problem.

Make sure to play with some different approaches. Find a decent learning algorithm and hold that static while you play with your input features and see what improves things or otherwise.

Post back here after you do some analysis and let us know what ended up working or not.

  • 1
    $\begingroup$ This suggestion seems to be even worse than cosine and sine because it turns one feature into eight instead of two--and loses information in the process. Because cosine and sine perfectly and completely capture wind directions, why are you uncomfortable with them? $\endgroup$ – whuber Dec 11 '15 at 15:22
  • 1
    $\begingroup$ I thought about this but then during clustering the wind N and NE would be as "far away" from each other than the N and S wind and thats obviously not true. $\endgroup$ – michal111 Dec 11 '15 at 16:45
  • $\begingroup$ @whuber, I might be wrong, cos and sin might be a brilliant way to attack the problem, and I would certainly suggest trying them out in comparison. My "uneasiness" is in the lack of a solid linear separating plane and how that might play out under the assumption of vectors in a euclidean space. I might be wholly off base with that, it's just my hunch. Anyway, since cos/sin are on the table already I'm tossing out other brainstorming ideas. $\endgroup$ – David Parks Dec 11 '15 at 21:51
  • $\begingroup$ @michal111 what about 8 features for N,NE,E,SE,etc but rather than a strict {1,0} value you give them a [0:1] range value based on their closeness to the actual direction? Then you're not "leaping" from N to NE, you might have 0.8 N and 0.4 NE. I'm starting to worry about over-engineering the problem, but hey, this is only a few minutes to test out, so tossing out ideas probably won't hurt. Again, brainstorming ideas, and I still like the idea of linear separability it brings, assuming adding 8 features isn't a big problem. I don't usually think of 8 vs. 2 features as an immediate concern. $\endgroup$ – David Parks Dec 11 '15 at 21:58
  • $\begingroup$ I don't follow what you mean by "lack of a solid linear separating plane." Because sine and cosine are 2D coordinates of the circle, they ought to work fine for any kind of separation among directions. $\endgroup$ – whuber Dec 11 '15 at 22:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.