A single-Poisson/Gamma SurpriseModel. More...
#include <Surprise/SurpriseModel.H>
Public Member Functions | |
SurpriseModelSP1 (const double updatefac=0.5, const double sampleval=0.0, const double samplevar=1.0) | |
Constructor. See base class for details. | |
virtual | ~SurpriseModelSP1 () |
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 SurpriseModelSP1 &other) |
Compute surprise between us and another model. | |
virtual void | preComputeHyperParams (const SurpriseModelSP1 &sample) |
Is empty in this model. | |
virtual void | combineFrom (const Image< SurpriseModelSP1 > &models, const Image< float > &weights) |
Initialize us as a weighted combination of the given map of models. | |
virtual void | combineFrom (const Image< SurpriseModelSP1 > &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 single-Poisson/Gamma SurpriseModel.
This is a very simple SurpriseModel consisting of a single Gamma prior over Poisson, which is updated in a sliding-average manner.
In this implementation surprise is calculated before the alpha and beta parameters decay so that there is no baseline surprise when the prior and posterior are the same.
Definition at line 283 of file SurpriseModel.H.
SurpriseModelSP1::SurpriseModelSP1 | ( | const double | updatefac = 0.5 , |
|
const double | sampleval = 0.0 , |
|||
const double | samplevar = 1.0 | |||
) |
Constructor. See base class for details.
Definition at line 428 of file SurpriseModel.C.
SurpriseModelSP1::~SurpriseModelSP1 | ( | ) | [virtual] |
Virtual destructor ensures proper destruction of derived classes.
Definition at line 438 of file SurpriseModel.C.
void SurpriseModelSP1::combineFrom | ( | const Image< SurpriseModelSP1 > & | 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 514 of file SurpriseModel.C.
void SurpriseModelSP1::combineFrom | ( | const Image< SurpriseModelSP1 > & | models, | |
const Image< float > & | weights | |||
) | [inline, virtual] |
Initialize us as a weighted combination of the given map of models.
Definition at line 504 of file SurpriseModel.C.
double SurpriseModelSP1::getAlpha | ( | ) | const [inline] |
double SurpriseModelSP1::getBeta | ( | ) | const [inline] |
double SurpriseModelSP1::getMean | ( | ) | const [inline, virtual] |
double SurpriseModelSP1::getUpdateFac | ( | ) | const [inline, virtual] |
get our UpdateFac
Implements SurpriseModel.
Definition at line 543 of file SurpriseModel.C.
References SurpriseModel::itsUpdateFac.
double SurpriseModelSP1::getVar | ( | ) | const [inline, virtual] |
void SurpriseModelSP1::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 446 of file SurpriseModel.C.
References load().
void SurpriseModelSP1::load | ( | const double | sampleval, | |
const double | samplevar = 1.0 | |||
) | [inline, virtual] |
Load given sample mean and variance.
Implements SurpriseModel.
Definition at line 455 of file SurpriseModel.C.
References itsAlpha, itsBeta, itsN, and SurpriseModel::itsUpdateFac.
void SurpriseModelSP1::preComputeHyperParams | ( | const SurpriseModelSP1 & | sample | ) | [inline, virtual] |
Is empty in this model.
Definition at line 486 of file SurpriseModel.C.
void SurpriseModelSP1::preSetAlpha | ( | ) |
Pre set model alpha values.
Definition at line 555 of file SurpriseModel.C.
void SurpriseModelSP1::reset | ( | void | ) | [inline, virtual] |
Reset to initial state.
Implements SurpriseModel.
Definition at line 442 of file SurpriseModel.C.
References SurpriseModel::itsInitialVal, SurpriseModel::itsInitialVar, and load().
double SurpriseModelSP1::surprise | ( | const SurpriseModelSP1 & | other | ) | [inline, virtual] |
Compute surprise between us and another model.
Definition at line 463 of file SurpriseModel.C.
References itsAlpha, itsBeta, itsN, and SurpriseModel::itsUpdateFac.
double SurpriseModelSP1::itsAlpha [protected] |
our current Gamma alpha
Definition at line 339 of file SurpriseModel.H.
Referenced by getAlpha(), getMean(), getVar(), load(), preSetAlpha(), and surprise().
double SurpriseModelSP1::itsBeta [protected] |
our current Gamma beta
Definition at line 340 of file SurpriseModel.H.
Referenced by getBeta(), getMean(), getVar(), load(), preSetAlpha(), and surprise().
int SurpriseModelSP1::itsN [protected] |