From f7666b085e38549a8b1ebd50e7c7220ae4895249 Mon Sep 17 00:00:00 2001 From: Anton Romanov Date: Wed, 23 Jun 2021 15:40:57 +0400 Subject: [PATCH] fix forecast --- src/main/java/ru/ulstu/service/MethodParamBruteForce.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/ru/ulstu/service/MethodParamBruteForce.java b/src/main/java/ru/ulstu/service/MethodParamBruteForce.java index 753a7cc..1a4b8ec 100644 --- a/src/main/java/ru/ulstu/service/MethodParamBruteForce.java +++ b/src/main/java/ru/ulstu/service/MethodParamBruteForce.java @@ -68,9 +68,13 @@ public class MethodParamBruteForce { ModelingResult bestResult = results2.stream() .min(Comparator.comparing(modelingResult -> modelingResult.getScore().getDoubleValue())) .orElse(null); - return new ModelingResult(bestResult.getTimeSeriesMethod().getForecast(timeSeries, + + TimeSeries forecast = bestResult.getTimeSeriesMethod().getForecast(timeSeries, bestResult.getParamValues(), - countPoints), + countPoints); + forecast.getValue(0).setValue(timeSeries.getNumericValue(timeSeries.getLength() - 1)); + + return new ModelingResult(forecast, bestResult.getParamValues(), bestResult.getScore(), bestResult.getTimeSeriesMethod());