pyfli.cm_stats.chi_square#

Pearson and Neyman chi-square statistics and the degrees of freedom of a fit.

Functions

degrees_of_freedom(n, n_params[, minimum])

n - n_params, raised to at least minimum (None leaves it unbounded).

neyman_chi_square(model, data[, axis, floor])

Neyman chi-square sum((d - mu)^2 / max(d, floor)) along axis (variance from the data).

pearson_chi_square(model, data[, axis, floor])

Pearson chi-square sum((d - mu)^2 / max(mu, floor)) along axis -- the fit statistic reported before the switch to the Poisson deviance.

pearson_terms(model, data[, floor])

Per-gate Pearson terms (d - mu)^2 / max(mu, floor).

degrees_of_freedom(n, n_params, minimum=1)[source]#

n - n_params, raised to at least minimum (None leaves it unbounded).

Parameters:
Return type:

Any

pearson_terms(model, data, floor=1.0)[source]#

Per-gate Pearson terms (d - mu)^2 / max(mu, floor).

Parameters:
Return type:

Any

pearson_chi_square(model, data, axis=-1, floor=1.0)[source]#

Pearson chi-square sum((d - mu)^2 / max(mu, floor)) along axis – the fit statistic reported before the switch to the Poisson deviance. The default variance floor of 1 count makes it read below n - p when many gates hold less than one expected count.

Parameters:
Return type:

Any

neyman_chi_square(model, data, axis=-1, floor=1.0)[source]#

Neyman chi-square sum((d - mu)^2 / max(d, floor)) along axis (variance from the data).

Parameters:
Return type:

Any