This commit is contained in:
yinjiangyi
2021-08-06 09:38:04 +08:00
parent 2f884c19d4
commit 5c33957c11

View File

@@ -63,17 +63,14 @@ public class KalmanFilter {
// 平均 // 平均
forecastSeries = new ArrayList<>(); forecastSeries = new ArrayList<>();
Integer partitonNum = historicalSeries.size()/length; int partitionNum = historicalSeries.size()/length;
for(int i = 0; i<length; i++){ for(int i = 0; i<length; i++){
long sum = 0; long sum = 0;
for (int period=0; period<partitonNum; period++){ for (int period=0; period<partitionNum; period++){
sum += smoothSeries.get(length*period+i); sum += smoothSeries.get(length*period+i);
} }
forecastSeries.add((int)sum/partitonNum); forecastSeries.add((int)sum/partitionNum);
} }
//System.out.println("KF test: origin:" + historicalSeries + "\n smooth:" + smoothSeries + "\n baseline:" + forecastSeries);
} }
public ArrayList<Integer> getSmoothSeries() { public ArrayList<Integer> getSmoothSeries() {