use brute force for pages

This commit is contained in:
Anton Romanov 2021-05-29 10:53:32 +04:00
parent 50fb79670d
commit 61b2a21e2d
6 changed files with 31 additions and 30 deletions

View File

@ -1,3 +1,9 @@
/*
* Copyright (C) 2021 Anton Romanov - All Rights Reserved
* You may use, distribute and modify this code, please write to: romanov73@gmail.com.
*
*/
package ru.ulstu.pages; package ru.ulstu.pages;
import org.primefaces.model.chart.AxisType; import org.primefaces.model.chart.AxisType;
@ -24,8 +30,6 @@ import java.time.format.DateTimeFormatter;
@ViewScoped @ViewScoped
public class IndexView implements Serializable { public class IndexView implements Serializable {
private final static Logger LOG = LoggerFactory.getLogger(IndexView.class); private final static Logger LOG = LoggerFactory.getLogger(IndexView.class);
private LineChartModel model;
private String timeSeriesString = "1,2,3,2,1,2,3,2,1,2,3";
@Autowired @Autowired
private transient TimeSeriesService timeSeriesService; private transient TimeSeriesService timeSeriesService;
@ -33,8 +37,12 @@ public class IndexView implements Serializable {
@Autowired @Autowired
private transient UtilService utilService; private transient UtilService utilService;
private LineChartModel model;
private String timeSeriesString;
@PostConstruct @PostConstruct
public void init() { public void init() {
timeSeriesString = utilService.getTimeSeriesToString(utilService.getRandomTimeSeries(50));
createChart(); createChart();
} }

View File

@ -1,8 +1,6 @@
/* /*
* * Copyright (C) 2021 Anton Romanov - All Rights Reserved
* * Copyright (C) 2021 Anton Romanov - All Rights Reserved * You may use, distribute and modify this code, please write to: romanov73@gmail.com.
* * You may use, distribute and modify this code, please write to: romanov73@gmail.com.
*
* *
*/ */
@ -23,6 +21,11 @@ import ru.ulstu.tsMethods.exponential.parameter.ExponentialMethodParamValue;
@Service @Service
public class TimeSeriesService { public class TimeSeriesService {
private static final Logger LOGGER = LoggerFactory.getLogger(TimeSeriesService.class); private static final Logger LOGGER = LoggerFactory.getLogger(TimeSeriesService.class);
private final MethodParamBruteForce methodParamBruteForce;
public TimeSeriesService(MethodParamBruteForce methodParamBruteForce) {
this.methodParamBruteForce = methodParamBruteForce;
}
public TimeSeries getForecast(TimeSeries timeSeries, int countPoints) throws ModelingException { public TimeSeries getForecast(TimeSeries timeSeries, int countPoints) throws ModelingException {
TimeSeriesMethod method; TimeSeriesMethod method;
@ -32,10 +35,6 @@ public class TimeSeriesService {
} }
public TimeSeries smoothTimeSeries(TimeSeries timeSeries) throws ModelingException { public TimeSeries smoothTimeSeries(TimeSeries timeSeries) throws ModelingException {
//NoTrendNoSeason nn = new NoTrendNoSeason(timeSeries, ExponentialMethodParams.of(ExponentialParamName.ALPHA, 0.8)); return methodParamBruteForce.getSmoothedTimeSeries(timeSeries).getTimeSeries();
TimeSeriesMethod method;
method = new NoTrendNoSeason().createFor(timeSeries);
method = new AddTrendAddSeason().createFor(timeSeries);
return method.getModel();
} }
} }

View File

@ -1,8 +1,6 @@
/* /*
* * Copyright (C) 2021 Anton Romanov - All Rights Reserved
* * Copyright (C) 2021 Anton Romanov - All Rights Reserved * You may use, distribute and modify this code, please write to: romanov73@gmail.com.
* * You may use, distribute and modify this code, please write to: romanov73@gmail.com.
*
* *
*/ */
@ -10,7 +8,7 @@ package ru.ulstu.tsMethods.exponential.parameter;
public class Alpha extends ExponentialMethodParameter { public class Alpha extends ExponentialMethodParameter {
public Alpha() { public Alpha() {
super("ALPHA", 0, 1, DEFAULT_OPTIMIZATION_STEP); super("ALPHA", DEFAULT_MIN_VALUE, DEFAULT_MAX_VALUE, DEFAULT_OPTIMIZATION_STEP);
} }
public static Alpha getInstance() { public static Alpha getInstance() {

View File

@ -1,8 +1,6 @@
/* /*
* * Copyright (C) 2021 Anton Romanov - All Rights Reserved
* * Copyright (C) 2021 Anton Romanov - All Rights Reserved * You may use, distribute and modify this code, please write to: romanov73@gmail.com.
* * You may use, distribute and modify this code, please write to: romanov73@gmail.com.
*
* *
*/ */
@ -10,7 +8,7 @@ package ru.ulstu.tsMethods.exponential.parameter;
public class Beta extends ExponentialMethodParameter { public class Beta extends ExponentialMethodParameter {
public Beta() { public Beta() {
super("BETA", 0, 1, DEFAULT_OPTIMIZATION_STEP); super("BETA", DEFAULT_MIN_VALUE, DEFAULT_MAX_VALUE, DEFAULT_OPTIMIZATION_STEP);
} }
public static Beta getInstance() { public static Beta getInstance() {

View File

@ -1,8 +1,6 @@
/* /*
* * Copyright (C) 2021 Anton Romanov - All Rights Reserved
* * Copyright (C) 2021 Anton Romanov - All Rights Reserved * You may use, distribute and modify this code, please write to: romanov73@gmail.com.
* * You may use, distribute and modify this code, please write to: romanov73@gmail.com.
*
* *
*/ */
@ -16,6 +14,8 @@ import java.util.List;
public abstract class ExponentialMethodParameter extends MethodParameter { public abstract class ExponentialMethodParameter extends MethodParameter {
public static final Float DEFAULT_OPTIMIZATION_STEP = 0.1f; public static final Float DEFAULT_OPTIMIZATION_STEP = 0.1f;
public static final Float DEFAULT_MIN_VALUE = 0.1f;
public static final Float DEFAULT_MAX_VALUE = 0.99f;
private final Number minValue; private final Number minValue;
private final Number maxValue; private final Number maxValue;
private final Number optimizationStep; private final Number optimizationStep;

View File

@ -1,8 +1,6 @@
/* /*
* * Copyright (C) 2021 Anton Romanov - All Rights Reserved
* * Copyright (C) 2021 Anton Romanov - All Rights Reserved * You may use, distribute and modify this code, please write to: romanov73@gmail.com.
* * You may use, distribute and modify this code, please write to: romanov73@gmail.com.
*
* *
*/ */
@ -10,7 +8,7 @@ package ru.ulstu.tsMethods.exponential.parameter;
public class Gamma extends ExponentialMethodParameter { public class Gamma extends ExponentialMethodParameter {
public Gamma() { public Gamma() {
super("Gamma", 0, 1, DEFAULT_OPTIMIZATION_STEP); super("Gamma", DEFAULT_MIN_VALUE, DEFAULT_MAX_VALUE, DEFAULT_OPTIMIZATION_STEP);
} }
public static Gamma getInstance() { public static Gamma getInstance() {