RecencyPredictor Class Reference

#include <recencyPredictor.h>

Inheritance diagram for RecencyPredictor:
Inheritance graph
[legend]
Collaboration diagram for RecencyPredictor:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 RecencyPredictor (Configuration *, ContextTracker *, const char *)
 ~RecencyPredictor ()
virtual Prediction predict (const size_t size, const char **filter) const
 Generate prediction.
virtual void learn (const std::vector< std::string > &change)
virtual void update (const Observable *variable)

Private Member Functions

void set_lambda (const std::string &value)
void set_n_0 (const std::string &value)
void set_cutoff_threshold (const std::string &value)

Private Attributes

std::string LOGGER
std::string LAMBDA
std::string N_0
std::string CUTOFF_THRESHOLD
double lambda
double n_0
size_t cutoff_threshold
Dispatcher< RecencyPredictordispatcher

Detailed Description

Recency predictor, a recency promotion statistical predictor.

RecencyPredictor, based on recency promotion principle, generates predictions by assigning exponentially decaying probability values to previously encountered tokens. Tokens are assigned a probability value that decays exponentially with their distance from the current token, thereby promoting context recency

(from Wikipedia) A quantity is said to be subject to exponential decay if it decreases at a rate proportional to its value. Symbolically, this can be expressed as the following differential equation, where N is the quantity and λ is a positive number called the decay constant.

frac{dN}{dt} = -lambda N.

The solution to this equation is below:

N(t) = N_0 e^{-lambda t}

Here N(t) is the quantity at time t, and N0 = N(0) is the (initial) quantity, at time t = 0.

This is the form of the equation that is most commonly used to describe exponential decay. The constant of integration N0 denotes the original quantity at t = 0. (The notation λ for the decay constant is a remnant of the usual notation for an eigenvalue. In this case, λ is the eigenvalue of the opposite of the differentiation operator with N(t) as the corresponding eigenfunction).

Definition at line 64 of file recencyPredictor.h.


Constructor & Destructor Documentation

RecencyPredictor::RecencyPredictor ( Configuration config,
ContextTracker ct,
const char *  name 
)
RecencyPredictor::~RecencyPredictor (  ) 

Definition at line 54 of file recencyPredictor.cpp.


Member Function Documentation

void RecencyPredictor::learn ( const std::vector< std::string > &  change  )  [virtual]

Implements Predictor.

Definition at line 126 of file recencyPredictor.cpp.

Prediction RecencyPredictor::predict ( const size_t  size,
const char **  filter 
) const [virtual]

Generate prediction.

Parameters:
size desired prediction size
filter filter

Implements Predictor.

Definition at line 79 of file recencyPredictor.cpp.

References Prediction::addSuggestion(), Predictor::contextTracker, cutoff_threshold, endl(), ContextTracker::getPrefix(), ContextTracker::getToken(), lambda, Predictor::logger, n_0, Suggestion::setProbability(), Suggestion::setWord(), Prediction::size(), and Predictor::token_satisfies_filter().

Here is the call graph for this function:

void RecencyPredictor::set_cutoff_threshold ( const std::string &  value  )  [private]

Definition at line 72 of file recencyPredictor.cpp.

References cutoff_threshold, endl(), Predictor::logger, and Utility::toInt().

Referenced by RecencyPredictor().

Here is the call graph for this function:

Here is the caller graph for this function:

void RecencyPredictor::set_lambda ( const std::string &  value  )  [private]

Definition at line 59 of file recencyPredictor.cpp.

References endl(), lambda, Predictor::logger, and Utility::toDouble().

Referenced by RecencyPredictor().

Here is the call graph for this function:

Here is the caller graph for this function:

void RecencyPredictor::set_n_0 ( const std::string &  value  )  [private]

Definition at line 65 of file recencyPredictor.cpp.

References endl(), Predictor::logger, n_0, and Utility::toDouble().

Referenced by RecencyPredictor().

Here is the call graph for this function:

Here is the caller graph for this function:

void RecencyPredictor::update ( const Observable variable  )  [virtual]

Implements Observer.

Definition at line 129 of file recencyPredictor.cpp.

References Dispatcher< class_t >::dispatch(), dispatcher, endl(), Observable::get_name(), Observable::get_value(), and Predictor::logger.

Here is the call graph for this function:


Member Data Documentation

Definition at line 87 of file recencyPredictor.h.

Referenced by predict(), RecencyPredictor(), and set_cutoff_threshold().

std::string RecencyPredictor::CUTOFF_THRESHOLD [private]

Definition at line 83 of file recencyPredictor.h.

Referenced by RecencyPredictor().

Definition at line 89 of file recencyPredictor.h.

Referenced by RecencyPredictor(), and update().

double RecencyPredictor::lambda [private]

Definition at line 85 of file recencyPredictor.h.

Referenced by predict(), RecencyPredictor(), and set_lambda().

std::string RecencyPredictor::LAMBDA [private]

Definition at line 81 of file recencyPredictor.h.

Referenced by RecencyPredictor().

std::string RecencyPredictor::LOGGER [private]

Definition at line 80 of file recencyPredictor.h.

Referenced by RecencyPredictor().

double RecencyPredictor::n_0 [private]

Definition at line 86 of file recencyPredictor.h.

Referenced by predict(), RecencyPredictor(), and set_n_0().

std::string RecencyPredictor::N_0 [private]

Definition at line 82 of file recencyPredictor.h.

Referenced by RecencyPredictor().


The documentation for this class was generated from the following files:

Generated on 9 Feb 2015 for presage by  doxygen 1.6.1