Skip to content

Improve ceres

Stefano Camarda requested to merge improve-ceres into master

General improvements of ceres minimisation:

  • Log penalty terms
  • Cost function scaling
  • Covariance and error estimates
  • Improved output

LOG PENALTY TERMS

In the current implementation, the ceres cost function does not include the log penalty terms of the chi-square, leading to an incorrect minimisation when the option Chi2ExtraParam = 'PoissonCorr' is enabled in steering.txt.

The problem with the log penalty terms is that they can give a negative contribution to the chi-square, which would represent a complex residual in a least squares minimisation cost function.

In order to include the log penalty terms, I have added an additional set of Ndata residuals. A constant offset is added to these residuals, so that negative log terms do not lead to complex residuals.

In order to get the correct value of the cost function, a loss function is implemented which subtracts the constant offset which was added to the residuals of the log penalty terms.

COST FUNCTION SCALING

The cost function of ceres is normalised as 1/2 * ||fi||. I have added a factor of sqrt(2) to the residuals so that the ceres cost function exactly matches the chi-square value of FCN. This should give a more correct estimate of the parameters error.

COVARIANCE MATRIX

The covariance matrix calculation and error estimates for the fitted parameters are added. The global correlation coefficient, as estimated by MINUIT, is also added.

IMPROVED OUTPUT

Standard output is improved, and results are saved to parsout_0 and ceres.out.txt

Edited by Stefano Camarda

Merge request reports