Model

class sofia_redux.toolkit.utilities.base.Model(*args, error=1, mask=None, covar=True, stats=True, robust=0, eps=0.01, maxiter=100, ignorenans=True, fit_kwargs=None, eval_kwargs=None)[source]

Bases: object

Base model Class for fitting N-dimensional data

Attributes:
statsargparse.Namespace
Contains the following statistics:
samplesnumpy.ndarray (ndim, nsamples)

The samples used to fit the polynomial. samples[:-1] contain the independent variables for each dimension and samples[-1] contains the dependent variables. Note that all NaNs will have been stripped from the original input samples.

ndataint

The number of samples used to fit the polynomial

fitnumpy.array (nsamples,)

The fitted polynomial over the original sample points

residualsnumpy.ndarray (nsamples,)

The residual of fit(data) - data

sigmanumpy.ndarray (ncoeffs,)

The error of each polynomial coefficient (will only be calculated if a covariance matrix exists)

dofint

Degrees of Freedom of the fit

rmsfloat

Root Mean Square deviation of the fit

chi2float

Chi-Squared

rchi2float

Reduced Chi-Squared

qfloat

Goodness of fit, or survival function. The probability (0->1) that one of the samples is greater than chi2 away from the fit.

Attributes Summary

error

Don't create the error unless asked for or already present

state

Methods Summary

__call__(*independent_values[, dovar])

Evaluate the model

evaluate(samples[, dovar])

Place holder

initial_fit()

Place holder

print_params()

Print parameters to stdout.

print_stats()

Print statistical information on the fit to stdout.

refit_mask(mask[, covar])

Place holder

reshape(flattened_array[, copy])

Attributes Documentation

error

Don’t create the error unless asked for or already present

This is for the errors of the samples only

state

Methods Documentation

__call__(*independent_values, dovar=False)[source]

Evaluate the model

Parameters:
samplesn-tuple of array_like (shape)

n-features of independent variables.

dovarbool, optional

If True return the variance of the fit in addition to the fit.

Returns:
fit, [variance]numpy.ndarray (shape), [numpy.ndarray (shape)]

The output fit and optionally, the variance.

evaluate(samples, dovar=False)[source]

Place holder

initial_fit()[source]

Place holder

print_params()[source]

Print parameters to stdout.

Returns:
None
print_stats()[source]

Print statistical information on the fit to stdout.

Returns:
None
refit_mask(mask, covar=False)[source]

Place holder

reshape(flattened_array, copy=True)[source]