pymodelfit.core.ParametricModel

class pymodelfit.core.ParametricModel[source]

Bases: object

The superclass of all models with parameters.

Subclassing

Subclasses should implement the following abstract properties and methods:

  • __call__()

    Takes a single argument as the model input, returns the model output

  • params()

    a sequence of names for the parameters of the model

  • parvals()

    a sequence of values for the parameters of the model

Optional overrides:

  • pardict()

    a dictionary with keys as parameter names and values as the value for that parameter

  • inv()

    compute the inverse of the model

__init__()

x.__init__(...) initializes x; see help(type(x)) for signature

Methods

inv(output, *args, **kwargs) Compute the inverse of this model for the requested output.

Attributes

data The fitting data for this model.
errors Error on the data.
params A decorator indicating abstract properties.
pardict A dictionary of the parameter names and values.
parvals A decorator indicating abstract properties.
weightstype Determines the statistical interpretation of the weights in data.
data None

The fitting data for this model. Should be either None, or a tuple(datain,dataout,weights). Note that the weights are interpreted statistically as errors based on the weightstype attribute.

errors None

Error on the data. Sets the weights on data assuming the interpretation for errors given by weightstype. If data is None/missing, a TypeError will be raised.

inv(output, *args, **kwargs)[source]

Compute the inverse of this model for the requested output.

Parameters:output – The output value of the model at which to compute the inverse.
Returns:The input value at which the model produces output
Raises ModelTypeError:
 If the model is not invertable for the provided data set.
params None

A sequence of the parameter names (not editable for instances).

pardict None

A dictionary of the parameter names and values.

parvals None

The sequence of parameters values in the same order as params.

weightstype None

Determines the statistical interpretation of the weights in data. Can be:

  • ‘ierror’

    Weights act as inverse errors (default)

  • ‘ivar’

    Weights act as inverse variance

  • ‘error’

    Weights act as errors (non-standard - this makes points with larger error bars count more towards the fit).

  • ‘var’

    Weights act as variance (non-standard - this makes points with larger error bars count more towards the fit).

Previous topic

pymodelfit.core.ModelTypeError

Next topic

pymodelfit.core.AutoParamsMeta

This Page