#3 -- some fixes

This commit is contained in:
Anton Romanov 2022-10-08 11:56:36 +04:00 committed by Anton Skalkin
parent e9adff9a87
commit 55275e1716

View File

@ -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<AComponent> 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<AComponent> 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<AComponent> fuzzyTimeSeries, AComponent currentFuzzyValue) {
Map<AComponent, Integer> 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 - преобразование";