leastsquare

astropy.modeling.statistic.leastsquare(measured_vals, updated_model, weights, x, y=None)[source]

Least square statistic with optional weights.

Parameters
measured_valsndarray

Measured data values.

updated_modelModel

Model with parameters set by the current iteration of the optimizer.

weightsndarray

Array of weights to apply to each residual.

xndarray

Independent variable “x” to evaluate the model on.

yndarray, optional

Independent variable “y” to evaluate the model on, for 2D models.

Returns
resfloat

The sum of least squares.