3-ftransform-forecasting #5
17
src/main/java/ru/ulstu/target/AnomalyDecompose.java
Normal file
17
src/main/java/ru/ulstu/target/AnomalyDecompose.java
Normal 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;
|
||||
}
|
||||
}
|
35
src/main/java/ru/ulstu/target/AnomalyDifferenceSmoothed.java
Normal file
35
src/main/java/ru/ulstu/target/AnomalyDifferenceSmoothed.java
Normal 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;
|
||||
}
|
||||
}
|
14
src/main/java/ru/ulstu/target/AnomalyPredictive.java
Normal file
14
src/main/java/ru/ulstu/target/AnomalyPredictive.java
Normal 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;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user