业务场景自己想,这里只讨论技术实现。
这篇基于上一篇一次指数平滑的实现进行的升级版本,不再赘述概念性问题。
直接看公式:
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/fe548d8156f16124b5bb5ded1c4c7333.png)
上代码:
@PostMapping("/secondExponentialSmoothingMethod")
public String secondExponentialSmoothingMethod(@RequestBody SecondSmoothingEntity secondSmoothingEntity){
List<Double> realParamList = secondSmoothingEntity.getRealDataList();
Double lastSinglePredictParam = secondSmoothingEntity.getLastSinglePredictParam();
Double lastSecondPredictParam = secondSmoothingEntity.getLastSecondPredictParam();
Double resizeSecondPredict = secondSmoothingEntity.getLastSecondPredictParam();
int predictTime = secondSmoothingEntity.getPredictTime();
List<Double> singleGapList = new ArrayList<>();
List<Double> secondGapList = new ArrayList<>();
Map<Double,Double> singleGapMap = new HashMap<>();
Map<Double,Double> secondGapMap = new HashMap<>();