A Chi-Square SurpriseModel. More...
#include <Surprise/SurpriseModel.H>
Public Member Functions | |
SurpriseModelCS (const double updatefac=0.5, const double sampleval=0.0, const double samplevar=1.0) | |
Constructor. See base class for details. | |
virtual | ~SurpriseModelCS () |
Virtual destructor ensures proper destruction of derived classes. | |
virtual void | reset () |
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 | load (const double sampleval, const double samplevar=1.0) |
Load given sample mean and variance. | |
virtual double | surprise (const SurpriseModelCS &other) |
Compute surprise between us and another model. | |
virtual void | preComputeHyperParams (const SurpriseModelCS &sample) |
Is empty in this model. | |
virtual void | combineFrom (const Image< SurpriseModelCS > &models, const Image< float > &weights) |
Initialize us as a weighted combination of the given map of models. | |
virtual void | combineFrom (const Image< SurpriseModelCS > &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 double | getMean () const |
get our mean | |
virtual double | getVar () const |
get our variance | |
virtual double | getUpdateFac () const |
get our UpdateFac | |
double | getAlpha () const |
get our alpha | |
double | getBeta () const |
get out beta | |
void | preSetAlpha () |
Pre set model alpha values. | |
Protected Attributes | |
int | itsN |
our sample N | |
double | itsAlpha |
our current Gamma alpha | |
double | itsBeta |
our current Gamma beta |
A Chi-Square SurpriseModel.
This is a very simple SurpriseModel consisting of a single Gamma prior over Poisson, which is updated in a sliding-average manner. Beta is fixed as 1/2 so this is a special case where the Gamma is the Chi Square distribution.
Definition at line 492 of file SurpriseModel.H.
SurpriseModelCS::SurpriseModelCS | ( | const double | updatefac = 0.5 , |
|
const double | sampleval = 0.0 , |
|||
const double | samplevar = 1.0 | |||
) |
Constructor. See base class for details.
Definition at line 845 of file SurpriseModel.C.
SurpriseModelCS::~SurpriseModelCS | ( | ) | [virtual] |
Virtual destructor ensures proper destruction of derived classes.
Definition at line 855 of file SurpriseModel.C.
void SurpriseModelCS::combineFrom | ( | const Image< SurpriseModelCS > & | 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.
Definition at line 929 of file SurpriseModel.C.
void SurpriseModelCS::combineFrom | ( | const Image< SurpriseModelCS > & | models, | |
const Image< float > & | weights | |||
) | [inline, virtual] |
Initialize us as a weighted combination of the given map of models.
Definition at line 919 of file SurpriseModel.C.
double SurpriseModelCS::getAlpha | ( | ) | const [inline] |
double SurpriseModelCS::getBeta | ( | ) | const [inline] |
double SurpriseModelCS::getMean | ( | ) | const [inline, virtual] |
double SurpriseModelCS::getUpdateFac | ( | ) | const [inline, virtual] |
get our UpdateFac
Implements SurpriseModel.
Definition at line 958 of file SurpriseModel.C.
References SurpriseModel::itsUpdateFac.
double SurpriseModelCS::getVar | ( | ) | const [inline, virtual] |
void SurpriseModelCS::init | ( | const double | updatefac = 0.5 , |
|
const double | sampleval = 0.0 , |
|||
const double | samplevar = 1.0 | |||
) | [inline, virtual] |
Change intial state parameters.
Reimplemented from SurpriseModel.
Definition at line 863 of file SurpriseModel.C.
References load().
void SurpriseModelCS::load | ( | const double | sampleval, | |
const double | samplevar = 1.0 | |||
) | [inline, virtual] |
Load given sample mean and variance.
Implements SurpriseModel.
Definition at line 872 of file SurpriseModel.C.
References itsAlpha, itsBeta, itsN, and SurpriseModel::itsUpdateFac.
void SurpriseModelCS::preComputeHyperParams | ( | const SurpriseModelCS & | sample | ) | [inline, virtual] |
Is empty in this model.
Definition at line 903 of file SurpriseModel.C.
void SurpriseModelCS::preSetAlpha | ( | ) |
Pre set model alpha values.
Definition at line 970 of file SurpriseModel.C.
void SurpriseModelCS::reset | ( | void | ) | [inline, virtual] |
Reset to initial state.
Implements SurpriseModel.
Definition at line 859 of file SurpriseModel.C.
References SurpriseModel::itsInitialVal, SurpriseModel::itsInitialVar, and load().
double SurpriseModelCS::surprise | ( | const SurpriseModelCS & | other | ) | [inline, virtual] |
Compute surprise between us and another model.
Definition at line 880 of file SurpriseModel.C.
References itsAlpha, itsBeta, itsN, and SurpriseModel::itsUpdateFac.
double SurpriseModelCS::itsAlpha [protected] |
our current Gamma alpha
Definition at line 548 of file SurpriseModel.H.
Referenced by getAlpha(), getMean(), getVar(), load(), preSetAlpha(), and surprise().
double SurpriseModelCS::itsBeta [protected] |
our current Gamma beta
Definition at line 549 of file SurpriseModel.H.
Referenced by getBeta(), getMean(), getVar(), load(), preSetAlpha(), and surprise().
int SurpriseModelCS::itsN [protected] |