Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

PredictionStrategy Class Reference

Abstract baseclass for different monthly prediction methods. More...

#include <prediction.h>

Inheritance diagram for PredictionStrategy:

AbsoluteNeuralPrediction AverageDeltaPrediction CombinedPrediction DeltaNeuralPrediction PreviousYear PreviousYearsAvg StochasticPrediction ZeroDeltaPrediction List of all members.

Public Methods

virtual void make (const StringMap &params)
virtual void train (const Matrix &traindata, int startmonth)
virtual Ref< Matrix > predict (const Matrix &testdata, int startmonth) const
virtual PredictionTestResultstest (const Matrix &testdata, int startmonth) const
virtual void testCurve (const Matrix &testdata, int startmonth, const String &filename) const
const String & name () const

Static Protected Methods

Ref< Matrix > rowDeltas (const Matrix &matrix)

Protected Attributes

int mInputMonths

Detailed Description

Abstract baseclass for different monthly prediction methods.

Design Patterns: Strategy.

Definition at line 146 of file prediction.h.


Member Function Documentation

void make const StringMap &    params [virtual]
 

Initialization.

Reimplemented in CombinedPrediction, AbsoluteNeuralPrediction, and StochasticPrediction.

Definition at line 139 of file prediction.cc.

References mInputMonths.

Referenced by AbsoluteNeuralPrediction::make(), and CombinedPrediction::make().

const String& name   const [inline]
 

Returns the name of the prediction method.

Definition at line 159 of file prediction.h.

Ref< Matrix > predict const Matrix &    testdata,
int    startmonth
const [virtual]
 

Tests the data and returns the monthly predictions in matrix.

Must be implemented by prediction strategies.

Parameters:
startmonth  See train().

Reimplemented in PreviousYear, PreviousYearsAvg, AverageDeltaPrediction, CombinedPrediction, ZeroDeltaPrediction, AbsoluteNeuralPrediction, DeltaNeuralPrediction, and StochasticPrediction.

Definition at line 165 of file prediction.cc.

Referenced by test().

Ref< Matrix > rowDeltas const Matrix &    matrix [static, protected]
 

Calculates row deltas (differences between rows) for a matrix.

Row delta is the change in a column between two rows, that is, Deltas[r,c] = M[r+1,c] - M[r,c].

Returns:
Reference object to the delta matrix with one row less than the original matrix.

Definition at line 236 of file prediction.cc.

Referenced by AverageDeltaPrediction::train().

PredictionTestResults * test const Matrix &    testdata,
int    startmonth
const [virtual]
 

Tests the learning method with the given data.

Parameters:
inputmonths  Most prediction methods require at least one month of data before the first data point to be predicted. Thus, if you want to predict 12 months sequence, you have to give for example 13 months of test data. Some prefer two months, while some may require three or even more.
inputmonths  Number of months to be used as prediction inputs before the first predicted month. The testdata contains these patterns in the beginning in the set.
startmonth  See train().

Definition at line 186 of file prediction.cc.

References PredictionTestResults::addValue(), PredictionTestResults::calculate(), PredictionTestResults::make(), and predict().

void testCurve const Matrix &    testdata,
int    startmonth,
const String &    filename
const [virtual]
 

Tests the data and plots the result as a curve with GnuPlot.

Parameters:
filename  File where the EPS pictures should be printed.

Definition at line 224 of file prediction.cc.

void train const Matrix &    traindata,
int    startmonth
[virtual]
 

Trains the learning method with the given data.

Must be implemented by prediction strategies.

Parameters:
startmonth  Zero-based month number for the first sample in the data. The month number can be in range 0-11, but only the last two digits are interpreted as months, so it can have values like 199905 or 9905.
Parameters:
traindata  Data for training the method.

Reimplemented in PreviousYear, PreviousYearsAvg, AverageDeltaPrediction, CombinedPrediction, ZeroDeltaPrediction, AbsoluteNeuralPrediction, DeltaNeuralPrediction, and StochasticPrediction.

Definition at line 152 of file prediction.cc.


Member Data Documentation

int mInputMonths [protected]
 

Number of months to be used as prediction inputs before the first predicted month.

The testdata contains these patterns in the beginning in the set.

Definition at line 169 of file prediction.h.

Referenced by CombinedPrediction::make(), make(), and AbsoluteNeuralPrediction::makeSet().


The documentation for this class was generated from the following files:
Generated on Thu Feb 10 20:06:45 2005 for Inanna by doxygen1.2.18