models

package
v0.0.0-...-f4b9008 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 15, 2019 License: Apache-2.0 Imports: 3 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BrownianModel

type BrownianModel struct {
	// contains filtered or unexported fields
}

func NewBrownianModel

func NewBrownianModel(initialTime time.Time, initialState mat.Vector, cfg BrownianModelConfig) *BrownianModel

func (*BrownianModel) CovarianceTransition

func (m *BrownianModel) CovarianceTransition(dt time.Duration) mat.Matrix

func (*BrownianModel) InitialState

func (m *BrownianModel) InitialState() State

func (*BrownianModel) NewMeasurement

func (s *BrownianModel) NewMeasurement(value mat.Vector) *Measurement

func (*BrownianModel) Transition

func (m *BrownianModel) Transition(dt time.Duration) mat.Matrix

func (*BrownianModel) Value

func (s *BrownianModel) Value(state mat.Vector) mat.Vector

type BrownianModelConfig

type BrownianModelConfig struct {
	InitialVariance     float64
	ProcessVariance     float64
	ObservationVariance float64
}

type ConstantVelocityModel

type ConstantVelocityModel struct {
	// contains filtered or unexported fields
}

ConstantVelocityModel models a particle moving over time with state modelled by position and velocity.

func NewConstantVelocityModel

func NewConstantVelocityModel(initialTime time.Time, initialPosition mat.Vector, cfg ConstantVelocityModelConfig) *ConstantVelocityModel

NewConstantVelocityModel initialises a constant velocity model.

func (*ConstantVelocityModel) CovarianceTransition

func (m *ConstantVelocityModel) CovarianceTransition(dt time.Duration) mat.Matrix

CovarianceTransition returns the covariance of the process noise for the given time step. Note: This covariance is very simple, there are better ways to model the process noise for constant velocity models.

func (*ConstantVelocityModel) InitialState

func (m *ConstantVelocityModel) InitialState() State

InitialState initializes the model.

func (*ConstantVelocityModel) NewPositionMeasurement

func (m *ConstantVelocityModel) NewPositionMeasurement(position mat.Vector, variance float64) *Measurement

NewPositionMeasurement provides a new measurement for fusing into the model state. It is assumed the covariance of the measurement is a scaled identity matrix.

func (*ConstantVelocityModel) Position

func (m *ConstantVelocityModel) Position(state mat.Vector) mat.Vector

Position is a helper to read the position value frmo a state vector for this model.

func (*ConstantVelocityModel) Transition

func (m *ConstantVelocityModel) Transition(dt time.Duration) mat.Matrix

Transition returns the linear transformation that advances the model for the given time step.

func (*ConstantVelocityModel) Velocity

func (m *ConstantVelocityModel) Velocity(state mat.Vector) mat.Vector

type ConstantVelocityModelConfig

type ConstantVelocityModelConfig struct {
	InitialVariance float64
	ProcessVariance float64
}

ConstantVelocityModelConfig is used to set the variance of the process and the variance of the first measurement. It is assumed that the covariance of the state is a scaled identity matrix, so that the variance of each component of the position and velocity are identical. Observation variances in this model are provided on a per-measurement basis.

type LinearModel

type LinearModel interface {
	InitialState() State
	Transition(dt time.Duration) mat.Matrix
	CovarianceTransition(dt time.Duration) mat.Matrix
}

LinearModel is used to initialize hidden states in the model and provide transition matrices to the filter. kalman/models provides commonly used models.

type Measurement

type Measurement struct {
	Covariance       mat.Matrix
	Value            mat.Vector
	ObservationModel mat.Matrix
}

type SimpleModel

type SimpleModel struct {
	// contains filtered or unexported fields
}

SimpleModel provides the most basic Kalman Filter example of modelling a Brownian time series in a single dimension. This is just a wrapper around the BrownianModel, with a simplified interface that operates directly on floating point values rather than on vectors.

func NewSimpleModel

func NewSimpleModel(initialTime time.Time, initialValue float64, cfg SimpleModelConfig) *SimpleModel

func (*SimpleModel) CovarianceTransition

func (s *SimpleModel) CovarianceTransition(dt time.Duration) mat.Matrix

func (*SimpleModel) InitialState

func (s *SimpleModel) InitialState() State

func (*SimpleModel) NewMeasurement

func (s *SimpleModel) NewMeasurement(value float64) *Measurement

func (*SimpleModel) Transition

func (s *SimpleModel) Transition(dt time.Duration) mat.Matrix

func (*SimpleModel) Value

func (*SimpleModel) Value(state mat.Vector) float64

Value is a helper to extract the current value from the Kalman hidden state

type SimpleModelConfig

type SimpleModelConfig struct {
	InitialVariance     float64
	ProcessVariance     float64
	ObservationVariance float64
}

type State

type State struct {
	Time       time.Time
	State      mat.Vector
	Covariance mat.Matrix
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL