Problem

 
Problem = class Problem(builtins.object)
    Problem(model=None, xdata=None, ydata=None, weights=None, accuracy=None, copy=None)
 
Problem implements the common parts of specialized Problems.
 
A Problem is an optimization of parameters which does not involve
the fitting of data to a Model.
 
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( x, p )
The parameters, p, are to be optimized while the x provide additional
information.
 
This class is a base class. Further specializations will define the
result method.
 
Attributes
----------
model : Model
    to be optimized
xdata : array_like
    independent variable (static)
ydata : array_like
    dependent variable (static)
weights : array_like
    weights associated with ydata
varyy : float or ndarry of shape (ndata,)
    Variance in the errors of the ydata
npars : int
    number of parameters in the model of the problem
partype : float | int
    type of the parameters
 
 
Author :         Do Kester
 
  Constructor:
XXXweightedResiduals( param, mockdata=None, extra=False )
Returns the (weighted) residuals, calculated at the xdata.
 
Optionally (extra=True) the weighted signs of the residuals are returned too.
 
Parameters
----------
param : array_like
    values for the parameters.
mockdata : array_like
    model fit at xdata
extra : bool (False)
    true  : return ( wgt * res, wgt * sign( res ) )
    false : return wgt * res
Methods defined here:
Problem( model=None, xdata=None, ydata=None, weights=None, accuracy=None, copy=None )
Problem Constructor.
 
Parameters
----------
model : Model
    the model to be solved
xdata : array_like or None
    independent variable
ydata : array_like or None
    dependent variable
weights : array_like or None
    weights associated with 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
baseName()
copy()
Copy.
cyclicCorrection( res )
No correction.
 
Returns 
-------
    the residuals, unadultered
 
Parameters
----------
res : array_like
    residuals
cyclize( res, period )
Apply correction on residuals which are cyclic in some
phase space.
 
If the model results in a phase value of +ε
while the data give that phase value as (p - ε)
to keep all data in the range [0,p], the naive residual
would be (p - 2 ε) while the actual distance should
be measured the other way around as (2 ε).
Here p = period and ε = small deviation.
 
Parameters
----------
res : array_like
    original residuals
period : float
    of the phase space
 
Returns
-------
corrected residuals.
cycor1( res )
Returns the residuals, all corrected for periodicity in residuals
 
Parameters
----------
res : array_like
    residuals
cycor2( res )
Returns the residuals corrected for periodicity in residuals, only
the result dimensions listed in the model.cyclic dictionary.
 
Parameters
----------
res : array_like
    residuals
domain2Unit( dval, kpar )
Return value in [0,1] for the selected parameter.
 
Parameters
----------
dval : float
    domain value for the selected parameter
kpar : array_like
    selected parameter index, where kp is index in [parameters, hyperparams]
hasWeights()
Return whether it has weights.
isDynamic()
residuals( param, mockdata=None )
Returns the residuals, calculated at the xdata.
 
Parameters
----------
param : array_like
    values for the parameters.
mockdata : array_like
    model fit at xdata
result( param )
Returns the result using the parameters.
 
In this (base)class it is a placeholder.
 
Parameters
----------
param : array_like
    values for the parameters.
setAccuracy( accuracy=None )
set the value for accuracy.
 
Paramaters
----------
accuracy : float or array of NDATA floats or None
    Either one value for all or one for each data point
    When None the value is set to 0 (for easy computational reasons)
shortName()
Return a short version the string representation: upto first non-letter.
unit2Domain( uval, kpar )
Return domain value for the selected parameter.
 
Parameters
----------
uval : array_like
    unit value for the selected parameter
kpar : array_like
    selected parameter indices, where kp is index in [parameters, hyperparams]
weightedResSq( allpars, mockdata=None, extra=False )
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 * res^2