Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Algorithm to score similarness of sets of numbers

What is an algorithm to compare multiple sets of numbers against a target set to determine which ones are the most "similar"?

One use of this algorithm would be to compare today's hourly weather forecast against historical weather recordings to find a day that had similar weather.

The similarity of two sets is a bit subjective, so the algorithm really just needs to diferentiate between good matches and bad matches. We have a lot of historical data, so I would like to try to narrow down the amount of days the users need to look through by automatically throwing out sets that aren't close and trying to put the "best" matches at the top of the list.

Edit: Ideally the result of the algorithm would be comparable to results using different data sets. For example using the mean square error as suggested by Niles produces pretty good results, but the numbers generated when comparing the temperature can not be compared to numbers generated with other data such as Wind Speed or Precipitation because the scale of the data is different. Some of the non-weather data being is very large, so the mean square error algorithm generates numbers in the hundreds of thousands compared to the tens or hundreds that is generated by using temperature.

like image 906
Adam Hughes Avatar asked Dec 31 '22 10:12

Adam Hughes


1 Answers

I think the mean square error metric might work for applications such as weather compares. It's easy to calculate and gives numbers that do make sense.

Since your want to compare measurements over time you can just leave out missing values from the calculation.

For values that are not time-bound or even unsorted, multi-dimensional scatter data it's a bit more difficult. Choosing a good distance metric becomes part of the art of analysing such data.

like image 98
Nils Pipenbrinck Avatar answered Jan 01 '23 22:01

Nils Pipenbrinck