SurpriseModel Class Reference

A local (single-point) surprise model. More...

#include <Surprise/SurpriseModel.H>

Inheritance diagram for SurpriseModel:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 SurpriseModel (const double updatefac=0.5, const double sampleval=0.0, const double samplevar=1.0)
 Constructor.
virtual ~SurpriseModel ()
 Virtual destructor ensures proper destruction of derived classes.
virtual void reset ()=0
 Reset to initial state.
virtual void init (const double updatefac=0.5, const double sampleval=0.0, const double samplevar=1.0)
 Change intial state parameters.
virtual void resetUpdFac (const double updfac)
 Reset our update factor.
virtual void load (const double sampleval=0.0, const double samplevar=1.0)=0
 Load given sample mean and variance.
virtual double surprise (const SurpriseModel &sample)
 Compute surprise between us and another model.
virtual void preComputeHyperParams (const SurpriseModel &sample)
 Pre compute hyper parameters before combineFrom.
virtual void combineFrom (const Image< SurpriseModel > &models, const Image< float > &weights)
 Initialize us as a weighted combination of the given map of models.
virtual void combineFrom (const Image< SurpriseModel > &models, const Image< float > &weights, const Point2D< int > &pos, const int width, const int height, const int offset)
 Initialize us as a weighted combination of the given map of models.
virtual void setBias (const double slfac, const double ssfac, const SU_KL_BIAS klbias)
 Set up biases if needed for KL.
virtual double getMean () const =0
 get our mean
virtual double getVar () const =0
 get our variance
virtual double getUpdateFac () const =0
 get our UpdateFac

Protected Attributes

double itsUpdateFac
 our update factor
double itsInitialVal
 our initial value
double itsInitialVar
 our initial variance

Detailed Description

A local (single-point) surprise model.

This the base class and it cannot be implemented as some of its functions are purely virtual. It defines the basic interface. See the derivative classes for actual implementations.

Definition at line 56 of file SurpriseModel.H.


Constructor & Destructor Documentation

SurpriseModel::SurpriseModel ( const double  updatefac = 0.5,
const double  sampleval = 0.0,
const double  samplevar = 1.0 
)

Constructor.

Build a new SurpriseModel object and initialize it as if an infinitely long sequence of samples had been previously received by the model.

Parameters:
updatefac factor by which the current model is combine with a new model on an update. Valid values are in [0..1]
sampleval the value of the samples previously received.
samplevar a variance expressing the intrinsic variability in the measurement of those samples.

Definition at line 49 of file SurpriseModel.C.

SurpriseModel::~SurpriseModel (  )  [virtual]

Virtual destructor ensures proper destruction of derived classes.

Definition at line 55 of file SurpriseModel.C.


Member Function Documentation

void SurpriseModel::combineFrom ( const Image< SurpriseModel > &  models,
const Image< float > &  weights,
const Point2D< int > &  pos,
const int  width,
const int  height,
const int  offset 
) [inline, virtual]

Initialize us as a weighted combination of the given map of models.

Parameters:
models an array of models, one model at each pixel of the image.
weights the weight to be given to each model. Weights should sum to 1.0 and this is not checked for here for computational efficiency. In this version, the weight image should have double+1 the width and height of the Surprise image, and the weight for the current point will be taken at the center of the weight map, etc.
pos indicates the 2D coordinates of the center of the neighborhood in the Image
minw is the minimum weight below which we just don't include a model in the update

Definition at line 82 of file SurpriseModel.C.

void SurpriseModel::combineFrom ( const Image< SurpriseModel > &  models,
const Image< float > &  weights 
) [inline, virtual]

Initialize us as a weighted combination of the given map of models.

Parameters:
models an array of models, one model at each pixel of the image.
weights the weight to be given to each model. Weights should sum to 1.0 and this is not checked for here for computational efficiency.

Definition at line 77 of file SurpriseModel.C.

virtual double SurpriseModel::getMean (  )  const [pure virtual]
virtual double SurpriseModel::getUpdateFac (  )  const [pure virtual]
virtual double SurpriseModel::getVar (  )  const [pure virtual]
void SurpriseModel::init ( const double  updatefac = 0.5,
const double  sampleval = 0.0,
const double  samplevar = 1.0 
) [inline, virtual]
virtual void SurpriseModel::load ( const double  sampleval = 0.0,
const double  samplevar = 1.0 
) [pure virtual]
void SurpriseModel::preComputeHyperParams ( const SurpriseModel sample  )  [inline, virtual]

Pre compute hyper parameters before combineFrom.

Some models may need to update their hyper parameters BEFORE calling combineFrom. Particularly if the parameters have a covariance measure which must be updated before the models are combined

Definition at line 73 of file SurpriseModel.C.

virtual void SurpriseModel::reset (  )  [pure virtual]
void SurpriseModel::resetUpdFac ( const double  updfac  )  [inline, virtual]

Reset our update factor.

Definition at line 65 of file SurpriseModel.C.

References itsUpdateFac.

void SurpriseModel::setBias ( const double  slfac,
const double  ssfac,
const SU_KL_BIAS  klbias 
) [inline, virtual]

Set up biases if needed for KL.

Reimplemented in SurpriseModelGG.

Definition at line 91 of file SurpriseModel.C.

double SurpriseModel::surprise ( const SurpriseModel sample  )  [inline, virtual]

Compute surprise between us and another model.

Surprise is the KL distance between our current model and what that model will become once we update it with the sample passed in as argument. For the update, our current model is weighted by itsUpdateFac while the new model by (1.0-itsUpdateFac). Programmer note: derived classes will not provide a direct overload of this (and other) base functions, as instead they will implement functions with basically the same syntax but using an argument of the derived class. Since an implementation is not provided for this base function, you will get an error at link time if you call the derived functions with a base-class argument.

Definition at line 69 of file SurpriseModel.C.


Member Data Documentation

double SurpriseModel::itsInitialVal [protected]
double SurpriseModel::itsInitialVar [protected]
double SurpriseModel::itsUpdateFac [protected]

The documentation for this class was generated from the following files:
Generated on Sun May 8 08:26:04 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3