Java Code Examples for net.sourceforge.openforecast.ForecastingModel#forecast()
The following examples show how to use
net.sourceforge.openforecast.ForecastingModel#forecast() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OpenForecaster.java From yawl with GNU Lesser General Public License v3.0 | 5 votes |
@Override public double get() { if (_series.size() < MIN_MEANINGFUL_QUEUE_SIZE) { return getLastValue(_series); } ForecastingModel forecaster = net.sourceforge.openforecast.Forecaster.getBestForecast(_series); System.out.println("Selected forecasting model: " + forecaster.getForecastType()); DataSet transport = getForecastTransport(); forecaster.forecast(transport); return getLastValue(transport); }
Example 2
Source File: ExponentialSmoothingChartDemo.java From OpenForecast with GNU Lesser General Public License v2.1 | 5 votes |
/** * Use the given forecasting model to produce a TimeSeries object * representing the periods startIndex through endIndex, and containing * the forecast values produced by the model. * @param model the forecasting model to use to generate the forecast * series. * @param initDataSet data set to use to initialize the forecasting model. * @param startIndex the index of the first data point to use from the * set of potential forecast values. * @param endIndex the index of the last data point to use from the set * of potential forecast values. * @param title a title to give to the TimeSeries created. */ private TimeSeries getForecastTimeSeries( ForecastingModel model, DataSet initDataSet, int startIndex, int endIndex, String title ) { // Initialize the forecasting model model.init( initDataSet ); // Get range of data required for forecast DataSet fcDataSet = getDataSet( fc, startIndex, endIndex ); // Obtain forecast values for the forecast data set model.forecast( fcDataSet ); // Create a new TimeSeries TimeSeries series = new TimeSeries(title,fc.getTimePeriodClass()); // Iterator through the forecast results, adding to the series Iterator it = fcDataSet.iterator(); while ( it.hasNext() ) { DataPoint dp = (DataPoint)it.next(); int index = (int)dp.getIndependentValue("t"); series.add( fc.getTimePeriod(index), dp.getDependentValue() ); } return series; }
Example 3
Source File: ForecastingChartDemo.java From OpenForecast with GNU Lesser General Public License v2.1 | 5 votes |
/** * Use the given forecasting model to produce a TimeSeries object * representing the periods startIndex through endIndex, and containing * the forecast values produced by the model. * @param model the forecasting model to use to generate the forecast * series. * @param initDataSet data set to use to initialize the forecasting model. * @param startIndex the index of the first data point to use from the * set of potential forecast values. * @param endIndex the index of the last data point to use from the set * of potential forecast values. * @param title a title to give to the TimeSeries created. */ private TimeSeries getForecastTimeSeries( ForecastingModel model, DataSet initDataSet, int startIndex, int endIndex, String title ) { // Initialize the forecasting model model.init( initDataSet ); // Get range of data required for forecast DataSet fcDataSet = getDataSet( fc, startIndex, endIndex ); // Obtain forecast values for the forecast data set model.forecast( fcDataSet ); // Create a new TimeSeries TimeSeries series = new TimeSeries(title,fc.getTimePeriodClass()); // Iterator through the forecast results, adding to the series Iterator it = fcDataSet.iterator(); while ( it.hasNext() ) { DataPoint dp = (DataPoint)it.next(); int index = (int)dp.getIndependentValue("t"); series.add( fc.getTimePeriod(index), dp.getDependentValue() ); } return series; }