时间序列数据变化点检测

问题描述

我正在尝试将时间序列数据划分为不同的区域。

在每个时间段内,压力都在允许的最大应力水平下运行(未事先告知)。请参见下面的图片。

每次

编辑一个星期以上

enter image description here

如何检测不同时段的开始/结束?有人会指出我的方向吗?

一旦划分了不同的时区,我想我可以平均每个时区的几个最大读数,以得到最大允许应力。

解决方法

我可以说1h足够的值。然后,您可以计算平均值。 之后,您可以设置与之前的平均值相关的平均值。 一些伪代码,以使其可视化。

class Chunk:
  private double[] values;//For one hour,for example.
  double average();
enum Relation:
  FALLING,RISING,EQUAL

func algorithm(Chunk[] chunks){
  double averages=new double[chunks.length];
  for(int i=0;i<chunks.length;i++)
    averages[i]=chunks[i].average();
  //Got averages,now make it rising or falling or stay same.
  Relation[] relations=new Relation[chunks.length];
  for(int i=1;i<chunks.length;i++){
    double diff=averages[i]-averages[i-1];
    if(diff==0) //TODO,a bit of difference is allowed (Like deviations of +-3)
     relations[i]=EQUALS;
    else
     relations[i]=diff>0?RISING:FALLING;
  }
 // After that,you have to find sequences of many FALLING or RISING,followed by many EQUALS
}

要继续处理Relation的数组,可以将其划分为较小的数组,然后计算平均值(例如FALLING = 0,RISING = 1,EQUAL = 2)。之后,您只需像这样“合并”它们:

F=FALLING
R=RISING
E=EQUALS
//Before merging
[RREEEEFFEEEEERRREEEE]
//After merging
[REFERE]

在那里您可以看到山脉和山谷。

现在,要获取确切的值,当山脉或山谷开始时,您需要稍微扩展Chunk

class Chunk:
  //The value on x-Axis + the value of y-Axis
  private Tuple<Time,Double>[] values;
  //Tuple of Range,this chunk uses and the average value of this range
  Tuple<Tuple<Time,Time>,double> average();

此外,您不能再使用原始Relation,必须将其从范围开始到结束都用Range包裹起来。

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...