A joint Gamma/Gaussian SurpriseModel. More...
#include <Surprise/SurpriseModel.H>
Public Member Functions | |
SurpriseModelGG (const double updatefac=0.5, const double sampleval=0.0, const double samplevar=1.0) | |
Constructor. See base class for details. | |
virtual | ~SurpriseModelGG () |
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 SurpriseModelGG &other) |
Compute surprise between us and another model. | |
virtual void | preComputeHyperParams (const SurpriseModelGG &sample) |
Is empty in this model. | |
virtual void | combineFrom (const Image< SurpriseModelGG > &models, const Image< float > &weights) |
Initialize us as a weighted combination of the given map of models. | |
virtual void | combineFrom (const Image< SurpriseModelGG > &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 | |
virtual void | setBias (const double slfac, const double ssfac, const SU_KL_BIAS klbias) |
Set up biases if needed for KL. | |
double | getAlpha () const |
get our alpha | |
double | getBeta () const |
get out beta | |
Protected Attributes | |
bool | itsCombineFromRun |
Make sure we run combineFrom each iter. | |
int | itsN |
our sample N | |
SU_KL_BIAS | itsJointKLBiasType |
enum for kl bias type | |
double | itsAlpha |
our current Gamma alpha (time) | |
double | itsBeta |
our current Gamma beta (time) | |
double | itsMean |
our current Gauss mean (space) | |
double | itsVar |
our current Gauss variance (space) | |
double | itsSig |
our current sigma (space) | |
double | itsSum |
Holds the sum from combineFrom. | |
double | itsSS |
Holds the sum of squares from combineFrom. | |
double | itsWeightSum |
Holds the weight sum from combineFrom. | |
double | itsSLfac |
Temporal bias to apply if needed. | |
double | itsSSfac |
Spatial bias to apply if needed. |
A joint Gamma/Gaussian SurpriseModel.
This is a very simple SurpriseModel consisting of a single Gamma prior over Poisson (time), which is updated in a sliding-average manner. space is updated as a gaussian and the two are combined as a joint KL to compute surprise
Definition at line 559 of file SurpriseModel.H.
SurpriseModelGG::SurpriseModelGG | ( | const double | updatefac = 0.5 , |
|
const double | sampleval = 0.0 , |
|||
const double | samplevar = 1.0 | |||
) |
Constructor. See base class for details.
Definition at line 981 of file SurpriseModel.C.
SurpriseModelGG::~SurpriseModelGG | ( | ) | [virtual] |
Virtual destructor ensures proper destruction of derived classes.
Definition at line 996 of file SurpriseModel.C.
void SurpriseModelGG::combineFrom | ( | const Image< SurpriseModelGG > & | 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 1126 of file SurpriseModel.C.
void SurpriseModelGG::combineFrom | ( | const Image< SurpriseModelGG > & | models, | |
const Image< float > & | weights | |||
) | [inline, virtual] |
Initialize us as a weighted combination of the given map of models.
Definition at line 1116 of file SurpriseModel.C.
double SurpriseModelGG::getAlpha | ( | ) | const [inline] |
double SurpriseModelGG::getBeta | ( | ) | const [inline] |
double SurpriseModelGG::getMean | ( | ) | const [inline, virtual] |
double SurpriseModelGG::getUpdateFac | ( | ) | const [inline, virtual] |
get our UpdateFac
Implements SurpriseModel.
Definition at line 1155 of file SurpriseModel.C.
References SurpriseModel::itsUpdateFac.
double SurpriseModelGG::getVar | ( | ) | const [inline, virtual] |
void SurpriseModelGG::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 1004 of file SurpriseModel.C.
References load().
void SurpriseModelGG::load | ( | const double | sampleval, | |
const double | samplevar = 1.0 | |||
) | [inline, virtual] |
Load given sample mean and variance.
Implements SurpriseModel.
Definition at line 1013 of file SurpriseModel.C.
References itsAlpha, itsBeta, itsN, and SurpriseModel::itsUpdateFac.
void SurpriseModelGG::preComputeHyperParams | ( | const SurpriseModelGG & | sample | ) | [inline, virtual] |
Is empty in this model.
Definition at line 1093 of file SurpriseModel.C.
void SurpriseModelGG::reset | ( | void | ) | [inline, virtual] |
Reset to initial state.
Implements SurpriseModel.
Definition at line 1000 of file SurpriseModel.C.
References SurpriseModel::itsInitialVal, SurpriseModel::itsInitialVar, and load().
void SurpriseModelGG::setBias | ( | const double | slfac, | |
const double | ssfac, | |||
const SU_KL_BIAS | klbias | |||
) | [virtual] |
Set up biases if needed for KL.
Reimplemented from SurpriseModel.
Definition at line 1167 of file SurpriseModel.C.
References itsJointKLBiasType, itsSLfac, and itsSSfac.
double SurpriseModelGG::surprise | ( | const SurpriseModelGG & | other | ) | [inline, virtual] |
Compute surprise between us and another model.
Definition at line 1021 of file SurpriseModel.C.
References ASSERT, itsAlpha, itsBeta, itsCombineFromRun, itsJointKLBiasType, itsMean, itsN, itsSig, itsSLfac, itsSS, itsSSfac, itsSum, SurpriseModel::itsUpdateFac, itsVar, itsWeightSum, and sqrt().
double SurpriseModelGG::itsAlpha [protected] |
our current Gamma alpha (time)
Definition at line 619 of file SurpriseModel.H.
Referenced by getAlpha(), getMean(), getVar(), load(), and surprise().
double SurpriseModelGG::itsBeta [protected] |
our current Gamma beta (time)
Definition at line 620 of file SurpriseModel.H.
Referenced by getBeta(), getMean(), getVar(), load(), and surprise().
bool SurpriseModelGG::itsCombineFromRun [protected] |
Make sure we run combineFrom each iter.
Definition at line 616 of file SurpriseModel.H.
Referenced by surprise().
SU_KL_BIAS SurpriseModelGG::itsJointKLBiasType [protected] |
enum for kl bias type
Definition at line 618 of file SurpriseModel.H.
Referenced by setBias(), and surprise().
double SurpriseModelGG::itsMean [protected] |
our current Gauss mean (space)
Definition at line 621 of file SurpriseModel.H.
Referenced by surprise().
int SurpriseModelGG::itsN [protected] |
double SurpriseModelGG::itsSig [protected] |
double SurpriseModelGG::itsSLfac [protected] |
Temporal bias to apply if needed.
Definition at line 627 of file SurpriseModel.H.
Referenced by setBias(), and surprise().
double SurpriseModelGG::itsSS [protected] |
Holds the sum of squares from combineFrom.
Definition at line 625 of file SurpriseModel.H.
Referenced by surprise().
double SurpriseModelGG::itsSSfac [protected] |
Spatial bias to apply if needed.
Definition at line 628 of file SurpriseModel.H.
Referenced by setBias(), and surprise().
double SurpriseModelGG::itsSum [protected] |
Holds the sum from combineFrom.
Definition at line 624 of file SurpriseModel.H.
Referenced by surprise().
double SurpriseModelGG::itsVar [protected] |
our current Gauss variance (space)
Definition at line 622 of file SurpriseModel.H.
Referenced by surprise().
double SurpriseModelGG::itsWeightSum [protected] |
Holds the weight sum from combineFrom.
Definition at line 626 of file SurpriseModel.H.
Referenced by surprise().