Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
ROOT::Minuit2::MnStrategy Class Reference

API class for defining four levels of strategies: low (0), medium (1), high (2), very high (>=3); acts on: Migrad (behavioural), Minos (lowers strategy by 1 for Minos-own minimization), Hesse (iterations), Numerical2PDerivative (iterations)

The strategy level controls the trade-off between the speed and the reliability of the minimization and error calculation. A higher level spends more function evaluations to refine the gradient and the Hessian.

The table below documents every tunable that the strategy governs, together with its default value for each strategy level. Strategy 3 shares strategy 2's Migrad iteration parameters, but skips the expensive full initial Hessian at the seed stage (ComputeInitialHessian) and applies additional changes to the Hesse calculation that aim at a more accurate Hessian and allow returning the covariance matrix without forcing it to be positive-definite.

Name and effect Type Value for strategy n
0 1 2 3
ComputeInitialHessian bool false true false

Compute full initial Hessian for the seed state, which can be quite expensive for many parameters.

Usually, the initial approximation that leaves the off-diagonal elements at zero is good enough.

RefineGradientInHessian bool false true
After the diagonal second derivatives have been computed, recompute the first derivatives at the current point with the more accurate HessianGradientCalculator (which uses up to HessianGradientNCycles refinement cycles) instead of reusing the gradient from the last minimization step.
GradientNCycles unsigned int 2 3 5

Maximum number of cycles the numerical gradient calculator spends refining the finite-difference step size and the first-derivative estimate of each parameter. More cycles yield a more accurate gradient at the price of more function evaluations.

A cycle is stopped early once either GradientStepTolerance or GradientTolerance is met.

GradientStepTolerance double 0.5 0.3 0.1

Stop the numerical gradient refinement cycle early once the finite-difference step size has stabilized.

The parameter refers to the change in step size relative to the new step size.

This is the partner of the GradientTolerance parameter.

GradientTolerance double 0.1 0.05 0.02

Stop the numerical gradient refinement cycle early once the first-derivative estimate itself is stable.

The parameter refers to the change in the first-derivative estimate relative to the new estimate.

This is the partner of the GradientStepTolerance parameter.

HessianCentralFDMixedDerivatives unsigned int 0 1

Central finite difference is used for mixed partial derivatives (the off-diagonal terms of the Hessian).

This requires 3 extra function evaluations per derivative, but is necessary in the case of minima where there is high curvature (in the case of high stats) and the forward finite difference (default) behaviour leads incorrectly to a non-positive-definite covariance matrix.

HessianForcePosDef unsigned int 1 0

Force Hessian / covariance matrix to be positive-definite.

It can be useful to return the uncorrected covariance matrix, even if it is not positive definite.

One use case is to check just how far from positive-definiteness the matrix is by being able to examine the eigenvalues.

HessianG2Tolerance double 0.1 0.05 0.02 zero

Stop the Hessian diagonal refinement cycle early if the second derivative estimate itself is stable.

The parameter refers to the change in the second derivative estimate relative to the new estimate.

This is the partner of the HessianStepTolerance parameter.

In some cases, it can help to set it to zero. This was found to be necessary in cases where Asimov datasets were used for the minimization and there were very few iterations for the approximate covariance to be determined from.

HessianGradientNCycles unsigned int 1 2 6

Maximum number of refinement cycles used when the first derivatives are recomputed together with the Hessian (see RefineGradientInHessian).

This is the analogue of GradientNCycles, but for the more accurate gradient evaluated during the Hessian calculation.

HessianNCycles unsigned int 3 5 7

Maximum number of cycles used to compute each diagonal element of the Hessian (the second derivative with respect to a single parameter). More cycles refine the finite-difference step and give a more accurate second derivative.

A cycle is stopped early once either HessianStepTolerance or HessianG2Tolerance is met.

HessianRecomputeThreshold double inf 0.05 -inf

After a Migrad minimization, a full Hesse recomputation of the error matrix is triggered when the relative change of the covariance matrix in the last step (Dcovar) exceeds this threshold.

A value of inf means the Hessian is never recomputed and the approximate covariance accumulated during Migrad is kept, while -inf means it is always recomputed.

HessianStepTolerance double 0.5 0.3 0.1 zero

Stop the Hessian diagonal refinement cycle early if the estimated optimal finite-difference step size has stabilized.

The parameter refers to the change in step size relative to the new step size.

This is the partner of the HessianG2Tolerance parameter.

Just like with that parameter, it can make sense to set the tolerance to zero to ensure the most accurate Hessians.

StorageLevel int 1

How much of the minimization history is kept: 1 stores the full sequence of iterations, while 0 keeps only the last iterations.

This does not affect the minimization result, only the trace that can be inspected afterwards.

Definition at line 247 of file MnStrategy.h.

Public Member Functions

 MnStrategy ()
 
 MnStrategy (unsigned int)
 
bool ComputeInitialHessian () const
 
unsigned int GradientNCycles () const
 
double GradientStepTolerance () const
 
double GradientTolerance () const
 
unsigned int HessianCentralFDMixedDerivatives () const
 
unsigned int HessianForcePosDef () const
 
double HessianG2Tolerance () const
 
unsigned int HessianGradientNCycles () const
 
unsigned int HessianNCycles () const
 
double HessianRecomputeThreshold () const
 
double HessianStepTolerance () const
 
bool RefineGradientInHessian () const
 
void SetGradientNCycles (unsigned int n)
 
void SetGradientStepTolerance (double stp)
 
void SetGradientTolerance (double toler)
 
void SetHessianCentralFDMixedDerivatives (unsigned int flag)
 
void SetHessianForcePosDef (unsigned int flag)
 
void SetHessianG2Tolerance (double toler)
 
void SetHessianGradientNCycles (unsigned int n)
 
void SetHessianNCycles (unsigned int n)
 
void SetHessianStepTolerance (double stp)
 
void SetStorageLevel (unsigned int level)
 
int StorageLevel () const
 

Private Member Functions

MnStrategy NextLower () const
 
void SetHighStrategy ()
 
void SetLowStrategy ()
 
void SetMediumStrategy ()
 
void SetVeryHighStrategy ()
 

Private Attributes

unsigned int fGradNCyc
 
double fGradTlr
 
double fGradTlrStp
 
int fHessCFDG2
 
int fHessForcePosDef
 
unsigned int fHessGradNCyc
 
unsigned int fHessNCyc
 
double fHessTlrG2
 
double fHessTlrStp
 
int fStoreLevel
 
unsigned int fStrategy
 

Friends

class MnContours
 
class MnFunctionCross
 

#include <Minuit2/MnStrategy.h>

Constructor & Destructor Documentation

◆ MnStrategy() [1/2]

ROOT::Minuit2::MnStrategy::MnStrategy ( )

Definition at line 19 of file MnStrategy.cxx.

◆ MnStrategy() [2/2]

ROOT::Minuit2::MnStrategy::MnStrategy ( unsigned int stra)
explicit

Definition at line 25 of file MnStrategy.cxx.

Member Function Documentation

◆ ComputeInitialHessian()

bool ROOT::Minuit2::MnStrategy::ComputeInitialHessian ( ) const
inline

Definition at line 271 of file MnStrategy.h.

◆ GradientNCycles()

unsigned int ROOT::Minuit2::MnStrategy::GradientNCycles ( ) const
inline

Definition at line 256 of file MnStrategy.h.

◆ GradientStepTolerance()

double ROOT::Minuit2::MnStrategy::GradientStepTolerance ( ) const
inline

Definition at line 257 of file MnStrategy.h.

◆ GradientTolerance()

double ROOT::Minuit2::MnStrategy::GradientTolerance ( ) const
inline

Definition at line 258 of file MnStrategy.h.

◆ HessianCentralFDMixedDerivatives()

unsigned int ROOT::Minuit2::MnStrategy::HessianCentralFDMixedDerivatives ( ) const
inline

Definition at line 264 of file MnStrategy.h.

◆ HessianForcePosDef()

unsigned int ROOT::Minuit2::MnStrategy::HessianForcePosDef ( ) const
inline

Definition at line 265 of file MnStrategy.h.

◆ HessianG2Tolerance()

double ROOT::Minuit2::MnStrategy::HessianG2Tolerance ( ) const
inline

Definition at line 262 of file MnStrategy.h.

◆ HessianGradientNCycles()

unsigned int ROOT::Minuit2::MnStrategy::HessianGradientNCycles ( ) const
inline

Definition at line 263 of file MnStrategy.h.

◆ HessianNCycles()

unsigned int ROOT::Minuit2::MnStrategy::HessianNCycles ( ) const
inline

Definition at line 260 of file MnStrategy.h.

◆ HessianRecomputeThreshold()

double ROOT::Minuit2::MnStrategy::HessianRecomputeThreshold ( ) const

Definition at line 100 of file MnStrategy.cxx.

◆ HessianStepTolerance()

double ROOT::Minuit2::MnStrategy::HessianStepTolerance ( ) const
inline

Definition at line 261 of file MnStrategy.h.

◆ NextLower()

MnStrategy ROOT::Minuit2::MnStrategy::NextLower ( ) const
private

Definition at line 95 of file MnStrategy.cxx.

◆ RefineGradientInHessian()

bool ROOT::Minuit2::MnStrategy::RefineGradientInHessian ( ) const
inline

Definition at line 269 of file MnStrategy.h.

◆ SetGradientNCycles()

void ROOT::Minuit2::MnStrategy::SetGradientNCycles ( unsigned int n)
inline

Definition at line 275 of file MnStrategy.h.

◆ SetGradientStepTolerance()

void ROOT::Minuit2::MnStrategy::SetGradientStepTolerance ( double stp)
inline

Definition at line 276 of file MnStrategy.h.

◆ SetGradientTolerance()

void ROOT::Minuit2::MnStrategy::SetGradientTolerance ( double toler)
inline

Definition at line 277 of file MnStrategy.h.

◆ SetHessianCentralFDMixedDerivatives()

void ROOT::Minuit2::MnStrategy::SetHessianCentralFDMixedDerivatives ( unsigned int flag)
inline

Definition at line 286 of file MnStrategy.h.

◆ SetHessianForcePosDef()

void ROOT::Minuit2::MnStrategy::SetHessianForcePosDef ( unsigned int flag)
inline

Definition at line 290 of file MnStrategy.h.

◆ SetHessianG2Tolerance()

void ROOT::Minuit2::MnStrategy::SetHessianG2Tolerance ( double toler)
inline

Definition at line 281 of file MnStrategy.h.

◆ SetHessianGradientNCycles()

void ROOT::Minuit2::MnStrategy::SetHessianGradientNCycles ( unsigned int n)
inline

Definition at line 282 of file MnStrategy.h.

◆ SetHessianNCycles()

void ROOT::Minuit2::MnStrategy::SetHessianNCycles ( unsigned int n)
inline

Definition at line 279 of file MnStrategy.h.

◆ SetHessianStepTolerance()

void ROOT::Minuit2::MnStrategy::SetHessianStepTolerance ( double stp)
inline

Definition at line 280 of file MnStrategy.h.

◆ SetHighStrategy()

void ROOT::Minuit2::MnStrategy::SetHighStrategy ( )
private

Definition at line 66 of file MnStrategy.cxx.

◆ SetLowStrategy()

void ROOT::Minuit2::MnStrategy::SetLowStrategy ( )
private

Definition at line 38 of file MnStrategy.cxx.

◆ SetMediumStrategy()

void ROOT::Minuit2::MnStrategy::SetMediumStrategy ( )
private

Definition at line 52 of file MnStrategy.cxx.

◆ SetStorageLevel()

void ROOT::Minuit2::MnStrategy::SetStorageLevel ( unsigned int level)
inline

Definition at line 294 of file MnStrategy.h.

◆ SetVeryHighStrategy()

void ROOT::Minuit2::MnStrategy::SetVeryHighStrategy ( )
private

Definition at line 80 of file MnStrategy.cxx.

◆ StorageLevel()

int ROOT::Minuit2::MnStrategy::StorageLevel ( ) const
inline

Definition at line 267 of file MnStrategy.h.

Friends And Related Symbol Documentation

◆ MnContours

friend class MnContours
friend

Definition at line 298 of file MnStrategy.h.

◆ MnFunctionCross

friend class MnFunctionCross
friend

Definition at line 297 of file MnStrategy.h.

Member Data Documentation

◆ fGradNCyc

unsigned int ROOT::Minuit2::MnStrategy::fGradNCyc
private

Definition at line 308 of file MnStrategy.h.

◆ fGradTlr

double ROOT::Minuit2::MnStrategy::fGradTlr
private

Definition at line 310 of file MnStrategy.h.

◆ fGradTlrStp

double ROOT::Minuit2::MnStrategy::fGradTlrStp
private

Definition at line 309 of file MnStrategy.h.

◆ fHessCFDG2

int ROOT::Minuit2::MnStrategy::fHessCFDG2
private

Definition at line 315 of file MnStrategy.h.

◆ fHessForcePosDef

int ROOT::Minuit2::MnStrategy::fHessForcePosDef
private

Definition at line 316 of file MnStrategy.h.

◆ fHessGradNCyc

unsigned int ROOT::Minuit2::MnStrategy::fHessGradNCyc
private

Definition at line 314 of file MnStrategy.h.

◆ fHessNCyc

unsigned int ROOT::Minuit2::MnStrategy::fHessNCyc
private

Definition at line 311 of file MnStrategy.h.

◆ fHessTlrG2

double ROOT::Minuit2::MnStrategy::fHessTlrG2
private

Definition at line 313 of file MnStrategy.h.

◆ fHessTlrStp

double ROOT::Minuit2::MnStrategy::fHessTlrStp
private

Definition at line 312 of file MnStrategy.h.

◆ fStoreLevel

int ROOT::Minuit2::MnStrategy::fStoreLevel
private

Definition at line 317 of file MnStrategy.h.

◆ fStrategy

unsigned int ROOT::Minuit2::MnStrategy::fStrategy
private

Definition at line 306 of file MnStrategy.h.

Libraries for ROOT::Minuit2::MnStrategy:

The documentation for this class was generated from the following files: