00001 00024 #ifndef _AVERAGEPREDICTOR_H 00025 #define _AVERAGEPREDICTOR_H 00026 00027 #include "../Predictor.h" 00028 00032 class AveragePredictor: public PredictorAlgorithm 00033 { 00034 private: 00036 00040 unsigned windowSize; 00041 list<unsigned> window; 00042 map<unsigned, unsigned> frequencies; 00043 00044 public: 00045 // currently we only do most frequent prediction, as we only have categorical values 00046 //enum AveragingType { mean, movingAverage, exponentialSmoothing, median }; 00047 00048 //AveragePredictor(AveragingType type, unsigned int windowSize); 00050 AveragePredictor(predictorparams ¶ms); 00051 00052 // add a single step to the model 00053 virtual void addContexts(const membershiplist* contexts, time_t time); 00054 virtual void addContext(unsigned long contextId, time_t time); 00055 00056 virtual unsigned long getNextContext() const; 00057 virtual membershiplist getNextContexts() const; 00058 00059 virtual contexttrajectory getContextTrajectory(unsigned int start, unsigned int end) const; 00060 00061 virtual unsigned long getContextAt(time_t time) const; 00062 virtual membershiplist getContextsAt(time_t time) const; 00063 00064 virtual string serialize() const; 00065 virtual void unserialize(string data); 00066 00067 #if _DEBUG_PREDICTORS 00068 00069 virtual string toString() const; 00070 #endif 00071 }; 00072 00073 #endif