BayesicFitting

Model Fitting and Evidence Calculation

View project on GitHub



class MultipleOutputProblem( Problem )[source]

A MultipleOutputProblem is an optimization of parameters where the model has multiple outputs. E.g. the orbit of a double star or the outcome of a game.

Problems can be solved by NestedSampler, with appropriate Engines and ErrorDistributions.

The result of the function for certain x and p is given by problem.result( p ) The parameters, p, are to be optimized while the x provide additional information.

Attributes from Problem
model, xdata, ydata, weights, partype

  • Author : Do Kester

MultipleOutputProblem( model=None, xdata=None, ydata=None, weights=None, accuracy=None, copy=None ) [source]

Problem Constructor.

Parameters

  • model : Model
         the model to be solved. One with multiple outputs: model.ndout > 1
  • xdata : array_like
         independent variable
  • ydata : array_like
         dependent variable. shape = (len(xdata), model.ndout)
  • weights : array_like or None
         weights associated with ydata: shape = as xdata or as ydata
  • accuracy : float or ndarray of shape (ndata,)
         accuracy scale for the datapoints
         all the same or one for each data point
  • copy : Problem
         to be copied

copy( ) [source]
Copy.

expandFlat( weights, ndout ) [source]
Expand and flatten the arrays.

result( param ) [source]
Returns the result calculated at the xdata.

Parameters

  • param : array_like
         values for the parameters + nuisance params.

partial( param ) [source]
Returns the partials (df/dp) calculated at the xdata.

Parameters

  • param : array_like
         values for the parameters + nuisance params.

derivative( param ) [source]
Return the derivative of the internal model.

Parameters

  • param : array_like
         list of model parameters

residuals( param, mockdata=None ) [source]
Returns residuals in a flattened array.

weightedResSq( allpars, mockdata=None, extra=False ) [source]
Returns the (weighted) squared residuals, calculated at the xdata.

Optionally (extra=True) the weighted residuals themselves are returned too.

Parameters

  • allpars : array_like
         values for the parameters.
  • mockdata : array_like
         model fit at xdata
  • extra : bool (False)
         true : return ( wgt * res^2, wgt * res )
         false : return wgt * res2

myEngines( ) [source]
Return a default list of preferred engines

myStartEngine( ) [source]
Return the default preferred startengines

myDistribution( ) [source]
Return the name of the preferred error distribution

baseName( ) [source]

Returns a string representation of the model.

Methods inherited from Problem