From 55275e17169fec8c5e2d79ff82c11fc3124162c4 Mon Sep 17 00:00:00 2001 From: Anton Romanov Date: Sat, 8 Oct 2022 11:56:36 +0400 Subject: [PATCH] #3 -- some fixes --- .../ru/ulstu/method/ftransform/FTransform.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/main/java/ru/ulstu/method/ftransform/FTransform.java b/src/main/java/ru/ulstu/method/ftransform/FTransform.java index eb266e1..f84e613 100644 --- a/src/main/java/ru/ulstu/method/ftransform/FTransform.java +++ b/src/main/java/ru/ulstu/method/ftransform/FTransform.java @@ -9,7 +9,9 @@ import ru.ulstu.method.MethodParamValue; import ru.ulstu.method.MethodParameter; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; @Component public class FTransform extends Method { @@ -77,7 +79,7 @@ public class FTransform extends Method { List fuzzyValues = new ArrayList<>(); double diff = (maxValue - minValue) / NUMBER_OF_FUZZY_VALUES; for (int i = 0; i < NUMBER_OF_FUZZY_VALUES; i++) { - fuzzyValues.add(new AComponent(i * diff, i * diff + diff / 2, i * diff + diff)); + fuzzyValues.add(new AComponent(minValue + i * diff, minValue + i * diff + diff / 2, minValue + i * diff + diff)); } List fuzzyTimeSeries = new ArrayList<>(); @@ -90,6 +92,7 @@ public class FTransform extends Method { } } + for (int t = 1; t < forecast.getLength(); t++) { forecast.getValues().get(t).setValue(fTransformModel.getPiecewiseLinearTrend().getLastValue().getValue()); } @@ -101,6 +104,16 @@ public class FTransform extends Method { return FTransformModel.getAvailableParameters(); } + private AComponent findFuzzyValueByPrevious(List fuzzyTimeSeries, AComponent currentFuzzyValue) { + Map mostFrequentValues = new HashMap<>(); + for (int i = 0; i < fuzzyTimeSeries.size() - 1; i++) { + if (fuzzyTimeSeries.get(i).equals(currentFuzzyValue)) { + mostFrequentValues.put(fuzzyTimeSeries.get(i + 1), mostFrequentValues.getOrDefault(fuzzyTimeSeries.get(i + 1), 0) + 1); + } + } + mostFrequentValues.entrySet().stream() + } + @Override public String getName() { return "F - преобразование";