BayesicFitting

Model Fitting and Evidence Calculation

View project on GitHub



class PolynomialDynamicModel( PolynomialModel,Dynamic )Source

General polynomial model of an adaptable degree.

f( x:p ) = ∑ pk * xk

where the sum is over k running from 0 to degree ( inclusive ).

It is a linear model.

Author Do Kester

Examples

poly = PolynomialDynamicModel( )         # polynomial with unknown degree
poly.grow( )                         # starts at degree = 0, npar = 1
poly.grow( )                         # each grow( ) adds 1
poly.grow( )
poly.grow( )
print poly.npchain
5
poly.shrink( )                        # shrink( ) deletes 1 degree
print poly.npbase
4

Attributes

  • minDegree : int
         minimum degree of the polynomial
  • maxDegree : int or None
         maximum degree of the polynomial

Attributes from Dynamic

     ncomp (=degree+1), deltaNpar, minComp (=minDegree+1), maxComp (=maxDegree+1), growPrior

Attributes from PolynomialModel

     degree

Attributes from Model

     npchain, parameters, stdevs, xUnit, yUnit

Attributes from FixedModel

     npmax, fixed, parlist, mlist

Attributes from BaseModel

     npbase, ndim, priors, posIndex, nonZero, tiny, deltaP, parNames

Category mathematics/Fitting

PolynomialDynamicModel( degree, minDegree=0, maxDegree=None, fixed=None, growPrior=None, copy=None, **kwargs )

Polynomial of a adaptable degree.

The model starts as a PolynomialModel of degree = 0. Growth of the model is governed by a exponential prior ( scale=1 ).

Parameters

  • degree : int
         degree to start with; it should be minDegree <= degree <= maxDegree
  • minDegree : int
         minimum degree of polynomial (def=0)
  • maxDegree : None or int
         maximum degree of polynomial (def=None)
  • growPrior : None or Prior
         governing the birth and death.
         ExponentialPrior (scale=2) if maxDegree is None else UniformPrior
  • copy : PolynomialDynamicModel
         model to copy

Raises

AttributeError when fixed parameters are requested ValueError when degree is outside [min..max] range

copy( )

Copy method.

isDynamic( )

changeNComp( dn )

baseName( )

Return a string representation of the model.

Methods inherited from PolynomialModel,
Methods inherited from LinearModel
Methods inherited from Model
Methods inherited from FixedModel
Methods inherited from BaseModel
Methods inherited from Dynamic