nifty8.re.minisanity module#
- class ChiSqStats(mean, reduced_chisq, ndof)[source]#
Bases:
NamedTuple
- mean: Any#
Alias for field number 0
- ndof: Any#
Alias for field number 2
- reduced_chisq: Any#
Alias for field number 1
- minisanity(position_or_samples, func=None, *, map='lmap')[source]#
Wrapper for reduced_residual_stats to retrieve the reduced chi-squared and a pretty-printable string of the statistics.
- reduced_residual_stats(position_or_samples, func=None, *, map='lmap')[source]#
Computes the average, reduced chi-squared, and number of parameters as a summary statistics for a given input.
Parameters:#
- position_or_samples: tree-like or Samples
Input values to compute reduces chi-sq statistics. The statistics is computed for each leaf of the pytree, i.E. only array-like leafs are square averaged. If positin_or_samples is a Sample object, the chi-sq statistics is computed for each sample, and the sample mean and standard deviation of the statistics is returned.
- func: Callable (optional)
Function to apply to position_or_samples before computing the chi-sq statistics for. If provided, the statistics is computed for func(x) instead of x where x is either primals or a sample.
Returns:#
- stats: tree-like
Pytree of tuple containing the mean, reduced chi-squared, and number of parameters for each leaf of the input tree. For the mean and reduched chi-sq, a numpy array with the sample mean and sample std is returned. If samples is None, the second entry of this array is always zero.