net.sourceforge.openforecast.models
Class AbstractForecastingModel
- java.lang.Object
-
- net.sourceforge.openforecast.models.AbstractForecastingModel
-
- All Implemented Interfaces:
- ForecastingModel
- Direct Known Subclasses:
- AbstractTimeBasedModel, MultipleLinearRegressionModel, PolynomialRegressionModel, RegressionModel
public abstract class AbstractForecastingModel extends java.lang.Object implements ForecastingModel
This class implements a variety of methods that are common across all forecasting models. In particular, the calculation of the accuracy indicators can be generalized, and is therefore implemented in the method, calculateAccuracyIndicators.- Since:
- 0.3
- See Also:
calculateAccuracyIndicators(net.sourceforge.openforecast.DataSet)
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description DataSetforecast(DataSet dataSet)Using the current model parameters (initialized in init), apply the forecast model to the given data set.doublegetAIC()Returns the Akaike Information Criteria obtained from applying the current forecasting model to the initial data set to try and predict each data point.doublegetBias()Returns the bias - the arithmetic mean of the errors - obtained from applying the current forecasting model to the initial data set to try and predict each data point.doublegetMAD()Returns the mean absolute deviation obtained from applying the current forecasting model to the initial data set to try and predict each data point.doublegetMAPE()Returns the mean absolute percentage error obtained from applying the current forecasting model to the initial data set to try and predict each data point.doublegetMSE()Returns the mean square of the errors (MSE) obtained from applying the current forecasting model to the initial data set to try and predict each data point.doublegetSAE()Returns the Sum of Absolute Errors (SAE) obtained by applying the current forecasting model to the initial data set.-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.sourceforge.openforecast.ForecastingModel
forecast, getForecastType, getNumberOfPredictors, init, toString
-
-
-
-
Method Detail
-
getAIC
public double getAIC()
Returns the Akaike Information Criteria obtained from applying the current forecasting model to the initial data set to try and predict each data point. The result is an indication of the accuracy of the model when applied to your initial data set - the smaller the Akaike Information Criteria (AIC), the more accurate the model.- Specified by:
getAICin interfaceForecastingModel- Returns:
- the Akaike Information Criteria (AIC) when the current model was applied to the initial data set.
- Throws:
ModelNotInitializedException- if getAIC is called before the model has been initialized with a call to init.- Since:
- 0.5
-
getBias
public double getBias()
Returns the bias - the arithmetic mean of the errors - obtained from applying the current forecasting model to the initial data set to try and predict each data point. The result is an indication of the accuracy of the model when applied to your initial data set - the smaller the bias, the more accurate the model.- Specified by:
getBiasin interfaceForecastingModel- Returns:
- the bias - mean of the errors - when the current model was applied to the initial data set.
- Throws:
ModelNotInitializedException- if getBias is called before the model has been initialized with a call to init.
-
getMAD
public double getMAD()
Returns the mean absolute deviation obtained from applying the current forecasting model to the initial data set to try and predict each data point. The result is an indication of the accuracy of the model when applied to your initial data set - the smaller the Mean Absolute Deviation (MAD), the more accurate the model.- Specified by:
getMADin interfaceForecastingModel- Returns:
- the mean absolute deviation (MAD) when the current model was applied to the initial data set.
- Throws:
ModelNotInitializedException- if getMAD is called before the model has been initialized with a call to init.
-
getMAPE
public double getMAPE()
Returns the mean absolute percentage error obtained from applying the current forecasting model to the initial data set to try and predict each data point. The result is an indication of the accuracy of the model when applied to the initial data set - the smaller the Mean Absolute Percentage Error (MAPE), the more accurate the model.- Specified by:
getMAPEin interfaceForecastingModel- Returns:
- the mean absolute percentage error (MAPE) when the current model was applied to the initial data set.
- Throws:
ModelNotInitializedException- if getMAPE is called before the model has been initialized with a call to init.
-
getMSE
public double getMSE()
Returns the mean square of the errors (MSE) obtained from applying the current forecasting model to the initial data set to try and predict each data point. The result is an indication of the accuracy of the model when applied to your initial data set - the smaller the Mean Square of the Errors, the more accurate the model.- Specified by:
getMSEin interfaceForecastingModel- Returns:
- the mean square of the errors (MSE) when the current model was applied to the initial data set.
- Throws:
ModelNotInitializedException- if getMSE is called before the model has been initialized with a call to init.
-
getSAE
public double getSAE()
Returns the Sum of Absolute Errors (SAE) obtained by applying the current forecasting model to the initial data set. Initialized following a call to init.- Specified by:
getSAEin interfaceForecastingModel- Returns:
- the sum of absolute errors (SAE) obtained by applying this forecasting model to the initial data set.
- Throws:
ModelNotInitializedException- if getSAE is called before the model has been initialized with a call to init.
-
forecast
public DataSet forecast(DataSet dataSet)
Using the current model parameters (initialized in init), apply the forecast model to the given data set. Each data point in the data set must have valid values for the independent variables. Upon return, the value of the dependent variable will be updated with the forecast values computed. This method is provided as a convenience method, and iterates through the data set invoking forecast(DataPoint) to do the actual forecast for each data point. In general, it is not necessary to override this method. However, if a subclass can provide a more efficient approach then it is recommended that the subclass provide its own implementation.- Specified by:
forecastin interfaceForecastingModel- Parameters:
dataSet- the set of data points for which forecast values (for the dependent variable) are required.- Returns:
- the same data set passed in but with the dependent values updated to contain the new forecast values.
- Throws:
ModelNotInitializedException- if getMSE is called before the model has been initialized with a call to init.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG