SwissFit objects¶
- class swissfit.SwissFit(data=None, udata=None, prior=None, uprior=None, p0=None, fit_fcn=None, prior_fcn=None, prior_transformation_fcn={}, data_svdcut=None, prior_svdcut=None)¶
Fit with SwissFit
SwissFit objects can be used to fit data by maximum a posterior (MAP) estimation or direct sampling from the posterior.
- Variables:
data (dict) – Dictionary of the form {‘y’: y_data} or {‘x’: x_data, ‘y’: y_data}. Each element of data[‘x’] must be a list/array with “n_args - 1” entries, where “n_args” is the number of positional arguments of ‘fit_fcn’. For example, if fit_fcn has three positional arguments, then data[‘x’] might look like data[‘x’] = [[a,b], [c,d], …]. The entries of each element of data[‘x’] must be floats. data[‘y’] is a one-dimensional array of GVar variables.
prior (dict) – Dictionary of lists/arrays containing priors. For example, prior = {‘a’: prior_a, ‘b’: prior_b, …} where prior_a = [aa, ab, …] and prior_b = [ba, bb, …]. Entries of lists/arrays must be GVar variables
p0 (dict) – Dictionary of lists/arrays of starting values for fit parameters. For example, p0 = {‘a’: p0_a, ‘b’: p0_b, …} where p0_a = [aa, ab, …] and p0_b = [ba, bb, …]. Entries of lists/arrays must be floats.
pmean (dict) – Mean of fit parameters as dictionary
pflat (Numpy array) – Flat array of fit parameter means
fit (SciPy Optimizer) – SciPy Optimizer object for getting fit parameters
- map_keys()¶
- data_residual()¶
- prior_residual()¶
- calculate_residual()¶
- calculate_chi2()¶
- calculate_jacobian()¶
- calculate_gradient()¶
- calculate_hessian()¶
- calculate_pdf()¶