BayesicFitting

Model Fitting and Evidence Calculation

View project on GitHub



class MaxLikelihoodFitter( IterativeFitter )Source

Base class with methods common to fitters handling ErrorDistributions.

Author: Do Kester.

Attributes

  • errdis : None | "gauss" | "laplace" | "cauchy" | "poisson" |
                     "uniform" | "exponential"
         None : Use _ChiSq as function to be minimized
         name : use -logLikelihood as function to be minimized from the named
                 errordistribution.
  • scale : float
         the (fixed) noise scale
  • power : float
         power of errdis (if applicable)

Raises

ConvergenceError Something went wrong during the convergence if the fit.

MaxLikelihoodFitter( xdata, model, errdis=None, scale=None, power=2.0, **kwargs )

Create a new iterative fitter, providing xdatas and model.

This is a base class. It collects stuff common to all iterative fitters. It does not work by itself.

Parameters

  • xdata : array_like
         array of independent input values

  • model : Model
         the model function to be fitted

  • errdis : None | "gauss" | "laplace" | "cauchy" | "poisson" |
                     "uniform" | "exponential"
         None : Use _ChiSq as function to be minimized
         name : use -logLikelihood as function to be minimized from the named
                 errordistribution.

  • scale : float
         the (fixed) noise scale of errdis (if applicable)

  • power : float (2.0)
         the power of errdis ( if applicable)

  • kwargs : dict
         Possibly includes keywords from
             IterativeFitter : maxIter, tolerance, verbose
             BaseFitter : map, keep, fixedScale

makeFuncs( data, weights=None, index=None, ret=3 )
Make connection to the desired func, gradient and hessian.

Parameters

  • data : array_like
         the data to be fitted
  • weights : array_like or None
         weights on the data
  • index : array_like
         indices of the parameters to be fitted.
  • ret : 1 or 2 or 3
         return (func), (func,dfunc) or (func,dfunc,hess)

getScale( )
Return the stdev of the noise.

getLogLikelihood( autoscale=False, var=1.0 )

normalize( normdfdp, normdata, weight=1.0 )
Not Implemented.

Raises

NotImplementedError. the method is not implemented for MaxLikelihoodFitters

testGradient( par, at, data, weights=None )
returns true if the test fails.
Methods inherited from IterativeFitter
Methods inherited from BaseFitter