时间序列中的峰值检测 [英] Peak Detection in Time Series

查看:1320
本文介绍了时间序列中的峰值检测的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在开展一个小项目,我想比较两个时间序列。相似性度量实际上是模糊的,如果两个时间序列大致具有相同的形状,则它们被认为是相似的。



所以我想我自己好吧,如果他们只需要为了具有相同的形状,我只比较两个时间序列的峰值,如果峰值位于相同的位置,那么时间序列肯定会类似



我现在的问题是为峰值检测找到一个好的算法。我使用谷歌,但我只提出了论文。总之,如果你的价值是:

 系列1系列2 
100 50
98 49
100 52
102 54

退货系列将是:

 系列1系列2 
-2.00%-2.00%
+ 2.04%+ 6.12%
+ 2.00%+ 3.85%

并且你计算这两个回归系列的相关性(在这个例子中:0.96),以计算两条曲线看起来相似的程度。您可能希望调整方差的结果(即,如果一个形状的范围比另一个更宽)。


I'm currently working on a little project in which I want to compare two time-series. The similarity measure is really vague, they are considered to be similar if the two time series roughly have the same shape.

So I thought to myself "Well if they only need to have the same shape, I just compare the peaks of the two time-series, if the peaks are at the same position, then surely the time-series will be similar"

My problem now is to find a good algorithm for the peak detection. I used google, but I only came up with the paper Simple Algorithms for Peak Detection in Time-Series. The problem is, the algorithms described in this paper work well with really extreme and thin peaks, but in the most cases, my time-series have rather flat peaks so they will not be detected.

Does anybody know where I could find or search for an algorithm which would detect the peaks shown in the following image?

解决方案

You seem to simply look for slope inversion (from positive to negative and vice versa). A rough java algo could be (not tested):

List<Point> points = ... //all the points in your curve
List<Point> extremes = new ArrayList<Point> ();
double previous = null;
double previousSlope = 0;

for (Point p : points) {
    if (previous == null) { previous = p; continue; }
    double slope = p.getValue() - previous.getValue();
    if (slope * previousSlope < 0) { //look for sign changes
        extremes.add(previous);
    }
    previousSlope = slope;
    previous = p;
}

Finally, a good way to measure similarity is correlation. In your case, I would look at % move correlation (in other words, you want your 2 series to go up or down at the same time) - that's typically what is done in finance where you calculate the correlation between 2 assets returns for example:

  • create 2 new series with the % move for each point of the 2 series
  • calculate the correlation between those 2 series

You can read more about returns correlations here for example. In summary, if your values are:

Series 1  Series 2
 100        50
 98         49
 100        52
 102        54

The "returns" series will be:

Series 1  Series 2
 -2.00%     -2.00%
 +2.04%     +6.12%
 +2.00%     +3.85%

And you calculate the correlation of those 2 returns series (in this example: 0.96) to get a measure of how much the 2 curves look alike. You might want to adjust the result for variance (i.e. if one shape has a much wider range than the other).

这篇关于时间序列中的峰值检测的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆