3-ftransform-forecasting #5
32
src/main/java/ru/ulstu/score/AnomalyCompressionScore.java
Normal file
32
src/main/java/ru/ulstu/score/AnomalyCompressionScore.java
Normal file
@ -0,0 +1,32 @@
|
||||
package ru.ulstu.score;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
import ru.ulstu.datamodel.exception.ModelingException;
|
||||
import ru.ulstu.datamodel.ts.TimeSeries;
|
||||
import ru.ulstu.datamodel.ts.TimeSeriesValue;
|
||||
import ru.ulstu.target.AnomalyDifferenceSmoothed;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
import static java.lang.Math.abs;
|
||||
|
||||
@Component
|
||||
public class AnomalyCompressionScore extends ScoreMethod {
|
||||
|
||||
private final AnomalyDifferenceSmoothed anomalyDifferenceSmoothed;
|
||||
public AnomalyCompressionScore(AnomalyDifferenceSmoothed anomalyDifferenceSmoothed) {
|
||||
super("Smape, %");
|
||||
this.anomalyDifferenceSmoothed = anomalyDifferenceSmoothed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Number evaluate(Map<LocalDateTime, Double> tsValues, TimeSeries model) throws ModelingException, ExecutionException, InterruptedException, InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException {
|
||||
var timeSeriesAnomalyResult = anomalyDifferenceSmoothed.calculate(model);
|
||||
var timeSeriesAnomaly = anomalyDifferenceSmoothed.calculate(tsValues);
|
||||
// туду: добавить сравнение аномальных точек
|
||||
return model.getLength()/tsValues.size() + Math.abs(timeSeriesAnomaly.getLength() - timeSeriesAnomalyResult.getLength());
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user