BayesicFitting

Model Fitting and Evidence Calculation

View project on GitHub



class ConstantModel( Model )Source

ConstantModel is a Model which does not have any parameters.

  f( x:p ) = f( x )

As such it is irrelevant whether it is linear or not. It has 0 params and returns a 0 for its partials.

ConstantModel, by default, returns a constant ( = 0 ) for its result. It can however return any fixed form that a Model can provide.

This might all seem quite irrelevant for fitting. And indeed no parameters can be fitted to these models, no standard deviations can be calculated, but it is possible to calculate the evidence for these models and compare them with more complicated models to decide whether there is any evidence for some structure at all.

It can also be used when some constant is needed in a compound model, or a family of similar shapes.

Attributes

  • fixedModel : Model
         a model which is calculated. (default: 0, everywhere)
  • table : array_like
         array of tabulated results

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

Examples

To make a model that decays to 1.0

model = ConstantModel( values=1.0 )
model.addModel( ExpModel( ) )
## To make a model that returns a fixed cosine of frequency 5
model = ConstantModel( fixedModel=SineModel(), values=[1.0,0.0,5.0] )

ConstantModel( ndim=1, copy=None, fixedModel=None, values=None, table=None )

The ConstantModel implementation.

Number of parameters = 0.

Parameters

  • ndim : int
         number of dimensions for the model. (default: 1)
  • copy : ConstantModel
         model to be copied. (default: None)
  • fixedModel : Model
         a fixed model to be returned. (default: 0 everywhere)
  • values : array_like
         parameters to be used in the fixedModel. (default: None)
  • table : array_like
         array of tabulated results

Notes

A table provided to the constructor has only values at the xdata. At other vales than xdata, the model does not work.

copy( )

Copy method.

baseResult( xdata, params )
Returns a constant form.

Parameters

  • xdata : array_like
         values at which to calculate the result
  • params : array_like
         values for the parameters. (irrelevant)

basePartial( xdata, params, parlist=None )
Returns the partials at the xdata value. (=empty array)

Parameters

  • xdata : array_like
         values at which to calculate the result
  • params : array_like
         values for the parameters. (irrelevant)
  • parlist : None
         only to complete the necessary argument list

baseDerivative( xdata, params )
Return the derivative df/dx at each point x (== 0).

Parameters

  • xdata : array_like
         values at which to calculate the result
  • params : array_like
         values for the parameters. (irrelevant)

baseName( )
Returns a string representation of the model.
Methods inherited from Model
Methods inherited from FixedModel
Methods inherited from BaseModel