A single-Poisson/Gamma SurpriseModel. More...
#include <Surprise/SurpriseModel.H>
Public Member Functions | |
SurpriseModelSPC (const double updatefac=0.5, const double sampleval=0.0, const double samplevar=1.0) | |
Constructor. See base class for details. | |
virtual | ~SurpriseModelSPC () |
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 SurpriseModelSPC &other) |
Compute surprise between us and another model. | |
virtual void | preComputeHyperParams (const SurpriseModelSPC &sample) |
Is empty in this model. | |
virtual void | combineFrom (const Image< SurpriseModelSPC > &models, const Image< float > &weights) |
Initialize us as a weighted combination of the given map of models. | |
virtual void | combineFrom (const Image< SurpriseModelSPC > &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 |
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.
This variant fixes the beta term which is useful for multi frame inputs
Definition at line 353 of file SurpriseModel.H.
SurpriseModelSPC::SurpriseModelSPC | ( | const double | updatefac = 0.5 , |
|
const double | sampleval = 0.0 , |
|||
const double | samplevar = 1.0 | |||
) |
Constructor. See base class for details.
Definition at line 566 of file SurpriseModel.C.
SurpriseModelSPC::~SurpriseModelSPC | ( | ) | [virtual] |
Virtual destructor ensures proper destruction of derived classes.
Definition at line 576 of file SurpriseModel.C.
void SurpriseModelSPC::combineFrom | ( | const Image< SurpriseModelSPC > & | 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 655 of file SurpriseModel.C.
void SurpriseModelSPC::combineFrom | ( | const Image< SurpriseModelSPC > & | models, | |
const Image< float > & | weights | |||
) | [inline, virtual] |
Initialize us as a weighted combination of the given map of models.
Definition at line 645 of file SurpriseModel.C.
double SurpriseModelSPC::getAlpha | ( | ) | const [inline] |
double SurpriseModelSPC::getBeta | ( | ) | const [inline] |
get out beta
Definition at line 692 of file SurpriseModel.C.
double SurpriseModelSPC::getMean | ( | ) | const [inline, virtual] |
get our mean
Implements SurpriseModel.
Definition at line 676 of file SurpriseModel.C.
References itsAlpha.
double SurpriseModelSPC::getUpdateFac | ( | ) | const [inline, virtual] |
get our UpdateFac
Implements SurpriseModel.
Definition at line 684 of file SurpriseModel.C.
References SurpriseModel::itsUpdateFac.
double SurpriseModelSPC::getVar | ( | ) | const [inline, virtual] |
get our variance
Implements SurpriseModel.
Definition at line 680 of file SurpriseModel.C.
References itsAlpha.
void SurpriseModelSPC::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 584 of file SurpriseModel.C.
References load().
void SurpriseModelSPC::load | ( | const double | sampleval, | |
const double | samplevar = 1.0 | |||
) | [inline, virtual] |
Load given sample mean and variance.
Implements SurpriseModel.
Definition at line 593 of file SurpriseModel.C.
References itsAlpha, itsN, and SurpriseModel::itsUpdateFac.
void SurpriseModelSPC::preComputeHyperParams | ( | const SurpriseModelSPC & | sample | ) | [inline, virtual] |
Is empty in this model.
Definition at line 627 of file SurpriseModel.C.
void SurpriseModelSPC::preSetAlpha | ( | ) |
void SurpriseModelSPC::reset | ( | void | ) | [inline, virtual] |
Reset to initial state.
Implements SurpriseModel.
Definition at line 580 of file SurpriseModel.C.
References SurpriseModel::itsInitialVal, SurpriseModel::itsInitialVar, and load().
double SurpriseModelSPC::surprise | ( | const SurpriseModelSPC & | other | ) | [inline, virtual] |
Compute surprise between us and another model.
Definition at line 601 of file SurpriseModel.C.
References D_LOG_SQRT_2, D_SQRT_2, itsAlpha, itsN, and SurpriseModel::itsUpdateFac.
double SurpriseModelSPC::itsAlpha [protected] |
our current Gamma alpha
Definition at line 409 of file SurpriseModel.H.
Referenced by getAlpha(), getMean(), getVar(), load(), preSetAlpha(), and surprise().
int SurpriseModelSPC::itsN [protected] |