Teetool Probabilistic modelling of trajectories

Public Member Functions | Private Member Functions | Private Attributes | List of all members
teetool.model.Model Class Reference

Model class provides the interface to the probabilistic modelling of trajectories. More...

Inheritance diagram for teetool.model.Model:

## Public Member Functions
def | __init__ (self, cluster_data, settings)
| Initialise a model. More...
def | clear (self)
def | getMean (self)
def | getSamples (self, nsamples)
def | getKS (self, cluster_data, sigma_arr, nsamples=100)
def | isInside_grid (self, sdwidth, xx, yy, zz=None)
def | isInside_pnts (self, P, sdwidth=1, nellipse=50)
def | evalLogLikelihood (self, xx, yy, zz=None)
def | getOutline (self, sdwidth=1)

## Private Member Functions
def | _norm2real (self, mu_y, sig_y, outline)
def | _clusterdata2points (self, cluster_data)
def | _getEllipse (self, c, A, sdwidth=1, nellipse=10)
def | _getSample (self, c, A, nsamples=1, std=1)
def | _getCoordsEllipse (self, nellipse=20, sdwidth=5)
def | _eval_logp (self, Y_pos)
def | _grid2points (self, xx, yy, zz=None)
def | _points2grid (self, s, Y_idx)
def | _get_point_cloud (self, sdwidth=1, nellipse=50)

## Private Attributes
| _ndim
| dimension of cluster_data More...
| _mu_y
| mean vector [ngaus*ndim x 1] More...
| _sig_y
| covariance matrix [ngaus*ndim x ngaus*ndim] More...
| _cc
| mean vector [ndim x 1] in ngaus cells More...
| _cA
| covariance matrix [ndim x ndim] in ngaus cells More...
| _list_tube
| previously calculated values confidence region More...
| _list_logp
| previously calculated values log-likelihood More...

## Detailed Description

Model class provides the interface to the probabilistic modelling of trajectories.

These trajectories are a single ensemble

## Constructor & Destructor Documentation

## § __init__()

def teetool.model.Model.__init__ | ( |  | self,
|  |  | cluster_data,
|  |  | settings
| ) |  |

Initialise a model.

Parameters

  self | object pointer
  cluster_data | list of (x, Y) trajectory data
  settings | a dictionary with "model_type" = resampling, ML, or EM "ngaus": number of Gaussians to create for output, REQUIRED for ML and EM, "basis_type" = gaussian, bernstein, "nbasis": number of basis functions

## Member Function Documentation

## § _clusterdata2points()

def teetool.model.Model._clusterdata2points | ( |  | self,
|  |  | cluster_data
| ) |  |
| private

    returns the points Y [npoints x ndim]

## § _eval_logp()

def teetool.model.Model._eval_logp | ( |  | self,
|  |  | Y_pos
| ) |  |
| private

    evaluates on a grid, aiming at the desired number of points

## § _get_point_cloud()

def teetool.model.Model._get_point_cloud | ( |  | self,
|  |  | sdwidth = `1`,
|  |  | nellipse = `50`
| ) |  |
| private

    returns a list with point clouds, representing the transition between Gaussians

    input paramters:
        - none

## § _getCoordsEllipse()

def teetool.model.Model._getCoordsEllipse | ( |  | self,
|  |  | nellipse = `20`,
|  |  | sdwidth = `5`
| ) |  |
| private

    returns an array of xy(z) coordinates

    nellipse is number of points in ellipsoid and sdwidth is the variance

## § _getEllipse()

def teetool.model.Model._getEllipse | ( |  | self,
|  |  | c,
|  |  | A,
|  |  | sdwidth = `1`,
|  |  | nellipse = `10`
| ) |  |
| private

    evaluates the ellipse

## § _getSample()

def teetool.model.Model._getSample | ( |  | self,
|  |  | c,
|  |  | A,
|  |  | nsamples = `1`,
|  |  | std = `1`
| ) |  |
| private

    returns nsamples samples of the given Gaussian

## § _grid2points()

def teetool.model.Model._grid2points | ( |  | self,
|  |  | xx,
|  |  | yy,
|  |  | zz = `None`
| ) |  |
| private

    returns an Y matrix for a given grid

    xx, yy, (zz) are mgrid

## § _norm2real()

def teetool.model.Model._norm2real | ( |  | self,
|  |  | mu_y,
|  |  | sig_y,
|  |  | outline
| ) |  |
| private

    returns the normalised values back to the original

## § _points2grid()

def teetool.model.Model._points2grid | ( |  | self,
|  |  | s,
|  |  | Y_idx
| ) |  |
| private

    converts points to a matrix

    s is values np.array and Y_idx is position np.array

## § clear()

def teetool.model.Model.clear | ( |  | self | ) |

    clears memory usage

## § evalLogLikelihood()

def teetool.model.Model.evalLogLikelihood | ( |  | self,
|  |  | xx,
|  |  | yy,
|  |  | zz = `None`
| ) |  |

    evaluates values in this grid [2d/3d] and returns values

    example grid:
    xx, yy, zz = np.mgrid[-60:60:20j, -10:240:20j, -60:60:20j]

## § getKS()

def teetool.model.Model.getKS | ( |  | self,
|  |  | cluster_data,
|  |  | sigma_arr,
|  |  | nsamples = `100`
| ) |  |

    calculated the ks value

    input:
        cluster_data    - data to evaluate against
        nsamples        - number of samples to use
        sigma_arr       - array which standard deviation to evalute

## § getMean()

def teetool.model.Model.getMean | ( |  | self | ) |

    returns the average trajectory [x, y, (z)]

## § getOutline()

def teetool.model.Model.getOutline | ( |  | self,
|  |  | sdwidth = `1`
| ) |  |

    returns the outline [xmin, xmax, ymin, ymax, zmin, zmax]

    input parameters:
        - sdwidth

## § getSamples()

def teetool.model.Model.getSamples | ( |  | self,
|  |  | nsamples
| ) |  |

    return nsamples of the model

## § isInside_grid()

def teetool.model.Model.isInside_grid | ( |  | self,
|  |  | sdwidth,
|  |  | xx,
|  |  | yy,
|  |  | zz = `None`
| ) |  |

    evaluate if points are inside a grid

    Input parameters:
        - sdwidth
        - xx
        - yy
        - zz (when 3d)

## § isInside_pnts()

def teetool.model.Model.isInside_pnts | ( |  | self,
|  |  | P,
|  |  | sdwidth = `1`,
|  |  | nellipse = `50`
| ) |  |

    tests if points P NxD 'points' x 'dimensions' are inside the tube

## Member Data Documentation

## § _cA

teetool.model.Model._cA
| private

covariance matrix [ndim x ndim] in ngaus cells

## § _cc

teetool.model.Model._cc
| private

mean vector [ndim x 1] in ngaus cells

## § _list_logp

teetool.model.Model._list_logp
| private

previously calculated values log-likelihood

## § _list_tube

teetool.model.Model._list_tube
| private

previously calculated values confidence region

## § _mu_y

teetool.model.Model._mu_y
| private

mean vector [ngaus*ndim x 1]

## § _ndim

teetool.model.Model._ndim
| private

dimension of cluster_data

## § _sig_y

teetool.model.Model._sig_y
| private

covariance matrix [ngaus*ndim x ngaus*ndim]

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

- teetool/model.py