add Target implementation

This commit is contained in:
sam 2023-04-03 22:51:19 +04:00
parent 4cb14518db
commit 292e774d8e
3 changed files with 66 additions and 0 deletions

View File

@ -0,0 +1,17 @@
package ru.ulstu.target;
import org.springframework.stereotype.Service;
import ru.ulstu.datamodel.ts.TimeSeries;
@Service
public class AnomalyDecompose extends Target {
public AnomalyDecompose() {
super("Разложение");
}
@Override
public TimeSeries calculate(TimeSeries model) {
return null;
}
}

View File

@ -0,0 +1,35 @@
package ru.ulstu.target;
import org.springframework.stereotype.Service;
import ru.ulstu.datamodel.ModelingResult;
import ru.ulstu.datamodel.exception.ModelingException;
import ru.ulstu.datamodel.ts.TimeSeries;
import ru.ulstu.datamodel.ts.TimeSeriesValue;
import ru.ulstu.service.TimeSeriesService;
import java.lang.reflect.InvocationTargetException;
import java.util.concurrent.ExecutionException;
@Service
public class AnomalyDifferenceSmoothed extends Target {
private final TimeSeriesService timeSeriesService;
public AnomalyDifferenceSmoothed(TimeSeriesService timeSeriesService) {
super("Модель сравнения со сглаженным ВР");
this.timeSeriesService = timeSeriesService;
}
@Override
public TimeSeries calculate(TimeSeries ts) throws ModelingException, ExecutionException, InterruptedException, InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException {
TimeSeries anomalyPoints = new TimeSeries();
TimeSeries residual = new TimeSeries();
ModelingResult modelingResult = timeSeriesService.smoothTimeSeries(ts, "AddTrendAddSeason");
var tsResult = modelingResult.getTimeSeries();
for (int i = 0; i < ts.getLength(); i++) {
residual.addValue(new TimeSeriesValue(ts.getValue(i).getDate(), Math.abs(ts.getNumericValue(i) - tsResult.getNumericValue(i))));
}
return null;
}
}

View File

@ -0,0 +1,14 @@
package ru.ulstu.target;
import ru.ulstu.datamodel.ts.TimeSeries;
public class AnomalyPredictive extends Target {
public AnomalyPredictive() {
super("Прогнозная модель, %");
}
@Override
public TimeSeries calculate(TimeSeries model) {
return null;
}
}