Teetool
Probabilistic modelling of trajectories
Public Member Functions | Private Member Functions | Private Attributes | List of all members
teetool.gaussianprocess.GaussianProcess Class Reference

GaussianProcess class evaluates an ensemble of trajectories as a Gaussian process. More...

Inheritance diagram for teetool.gaussianprocess.GaussianProcess:

Public Member Functions

def __init__ (self, cluster_data, ngaus)
 The constructor of GaussianProcess. More...
 
def model_by_resampling (self)
 models the trajectory data via re-sampling, ignoring noise, missing data, trends, etc. More...
 
def model_by_ml (self, type_basis, nbasis)
 models the trajectory data via maximum likelihood. More...
 
def model_by_em (self, type_basis, nbasis, maximum_iterations=2001)
 models the trajectory data via expectation maximization. More...
 

Private Member Functions

def _outline2vectors (self)
 obtain vectors to multiply normalised values with, allows for a transformation back to the actual values from the normalised ones. More...
 
def _norm2real (self, mu_y, sig_y)
 returns the mu_y, sig_y vector to the original dimensions using the outline More...
 
def _from_clusterdata2cells (self, cluster_data, basis)
 
def _Ewc_Ewwc (self, yc, Hc, mu_w, sig_w_inv, BETA_EM)
 
def _Ewn_Ewnwn (self, yn, Hn, mu_w, sig_w_inv, BETA_EM)
 
def _E_mu (self, Ewc)
 
def _E_sigma (self, mu_w, yc, Hc, Ewc, Ewwc)
 
def _E_beta (self, yc, Hc, Ewc, Ewwc, ndim, Mstar)
 
def _L_pYw (self, yc, Hc, Ewc, Ewwc, ndim, Mstar, BETA_EM)
 
def _L_pw (self, Ewc, Ewwc, mu_w, sig_w, sig_w_inv, ndim, nbasis)
 
def _getGMMCells (self, mu_y, sig_y, ngaus)
 
def _getMuSigma (self, mu_y, sig_y, npoint, ngaus)
 

Private Attributes

 _cluster_data
 normalised cluster_data More...
 
 _outline
 original outline More...
 
 _ngaus
 number of Gaussians after modelling More...
 
 _ndim
 dimensionality of trajectory data More...
 

Detailed Description

GaussianProcess class evaluates an ensemble of trajectories as a Gaussian process.

Such a Gaussian process has a mean and covariance, and expresses itself as an ellipse (2d) or ellipsoid (3d) at a constant variance

Constructor & Destructor Documentation

§ __init__()

def teetool.gaussianprocess.GaussianProcess.__init__ (   self,
  cluster_data,
  ngaus 
)

The constructor of GaussianProcess.

Parameters
selfobject pointer
cluster_datatrajectory data in specific format: a list of (x, Y), where x [npoints x 1] and Y [npoints x ndim]
ngausnumber of Gaussians desired

Member Function Documentation

§ _E_beta()

def teetool.gaussianprocess.GaussianProcess._E_beta (   self,
  yc,
  Hc,
  Ewc,
  Ewwc,
  ndim,
  Mstar 
)
private
returns the expected noise parameter

§ _E_mu()

def teetool.gaussianprocess.GaussianProcess._E_mu (   self,
  Ewc 
)
private
returns the expected value E [ MU ]

Input:
    Ewc - list of expected values

Output:
    mu_w - average of expected values

§ _E_sigma()

def teetool.gaussianprocess.GaussianProcess._E_sigma (   self,
  mu_w,
  yc,
  Hc,
  Ewc,
  Ewwc 
)
private
return the expected variance E [ SIGMA ]
this takes into account the measured data and the model

Input:
    mu_w -
    yc -
    Hc -
    Ewc -
    Ewwc -

Output:
    sig_w -

§ _Ewc_Ewwc()

def teetool.gaussianprocess.GaussianProcess._Ewc_Ewwc (   self,
  yc,
  Hc,
  mu_w,
  sig_w_inv,
  BETA_EM 
)
private
returns the expected values Ewc and Ewwc

input:
    yc          - [points]
    Hc          - [Gram matrix]
    mu_w        - E[w]
    sig_w_inv   - 1 / E[ww]
    BETA_EM     - 1 / noise

output:
    Ewc     - [E[wn]]
    Ewnwc   - [E[wnwn]]

§ _Ewn_Ewnwn()

def teetool.gaussianprocess.GaussianProcess._Ewn_Ewnwn (   self,
  yn,
  Hn,
  mu_w,
  sig_w_inv,
  BETA_EM 
)
private
returns the expected values Ewn and Ewnwn

input:
    yn          - points
    Hn          - Gram matrix
    mu_w        - E[w]
    sig_w_inv   - 1 / E[ww]
    BETA_EM     - 1 / noise

output:
    Ewn     - E[wn]
    Ewnwn   - E[wnwn]

§ _from_clusterdata2cells()

def teetool.gaussianprocess.GaussianProcess._from_clusterdata2cells (   self,
  cluster_data,
  basis 
)
private
converts from cluster_data (xn, Yn) list, to cells

Input:
    cluster_data -
    basis -

Output:
    yc -
    Hc -

§ _getGMMCells()

def teetool.gaussianprocess.GaussianProcess._getGMMCells (   self,
  mu_y,
  sig_y,
  ngaus 
)
private
return Gaussian Mixture Model (GMM) in cells

§ _getMuSigma()

def teetool.gaussianprocess.GaussianProcess._getMuSigma (   self,
  mu_y,
  sig_y,
  npoint,
  ngaus 
)
private
returns (mu, sigma)

§ _L_pw()

def teetool.gaussianprocess.GaussianProcess._L_pw (   self,
  Ewc,
  Ewwc,
  mu_w,
  sig_w,
  sig_w_inv,
  ndim,
  nbasis 
)
private
returns ln( p(w) )
likelihood of parameters, before seeing the data

§ _L_pYw()

def teetool.gaussianprocess.GaussianProcess._L_pYw (   self,
  yc,
  Hc,
  Ewc,
  Ewwc,
  ndim,
  Mstar,
  BETA_EM 
)
private
returns ln( p (Y|w) )
likelihood of data, given the parameters

§ _norm2real()

def teetool.gaussianprocess.GaussianProcess._norm2real (   self,
  mu_y,
  sig_y 
)
private

returns the mu_y, sig_y vector to the original dimensions using the outline

Parameters
selfThe object pointer.
mu_ymean vector [ngaus*ndim x 1]
sig_ycovariance matrix [ngaus*ndim x ngaus*ndim]

§ _outline2vectors()

def teetool.gaussianprocess.GaussianProcess._outline2vectors (   self)
private

obtain vectors to multiply normalised values with, allows for a transformation back to the actual values from the normalised ones.

Parameters
selfThe object pointer.
Returns
M, vector with minimum values [ngaus*ndim x 1]
D, vector with difference values [ngaus*ndim x 1]

§ model_by_em()

def teetool.gaussianprocess.GaussianProcess.model_by_em (   self,
  type_basis,
  nbasis,
  maximum_iterations = 2001 
)

models the trajectory data via expectation maximization.

It uses the basis function as specified to handle missing data, and, when noisy data is detected within a trajectory, the global trend, as learned, takes over. A suitable method in the presence of noise or an unknown shape of trajectories – the latter as different models can be compared via likelihood

Parameters
selfThe object pointer.
type_basissee Basis class for input
nbasissee Basis class for input
maximum_iterationsmaximum allowed number of evaluations till convergence
Returns
mu_y mean vector [ngaus*ndim x 1]
sig_y covariance matrix [ngaus*ndim x ngaus*ndim]
cc mean [ndim x 1] in ngaus cells
cA covariance [ndim x ndim] in ngaus cells

§ model_by_ml()

def teetool.gaussianprocess.GaussianProcess.model_by_ml (   self,
  type_basis,
  nbasis 
)

models the trajectory data via maximum likelihood.

It uses the basis function as specified to handle missing data, however, noise per trajectory has no influence on the parameter estimation. A suitable method in the absence of noise and known shape of trajectories.

Parameters
selfThe object pointer.
type_basissee Basis class for input
nbasissee Basis class for input
Returns
mu_y mean vector [ngaus*ndim x 1]
sig_y covariance matrix [ngaus*ndim x ngaus*ndim]
cc mean [ndim x 1] in ngaus cells
cA covariance [ndim x ndim] in ngaus cells

§ model_by_resampling()

def teetool.gaussianprocess.GaussianProcess.model_by_resampling (   self)

models the trajectory data via re-sampling, ignoring noise, missing data, trends, etc.

Quick method only suitable for high-quality data

Parameters
selfThe object pointer.
Returns
mu_y mean vector [ngaus*ndim x 1]
sig_y covariance matrix [ngaus*ndim x ngaus*ndim]
cc mean [ndim x 1] in ngaus cells
cA covariance [ndim x ndim] in ngaus cells

Member Data Documentation

§ _cluster_data

teetool.gaussianprocess.GaussianProcess._cluster_data
private

normalised cluster_data

§ _ndim

teetool.gaussianprocess.GaussianProcess._ndim
private

dimensionality of trajectory data

§ _ngaus

teetool.gaussianprocess.GaussianProcess._ngaus
private

number of Gaussians after modelling

§ _outline

teetool.gaussianprocess.GaussianProcess._outline
private

original outline


The documentation for this class was generated from the following file: