Class BFGS
This implementation of BFGS is based on Algorithm 6.1 from
Nocedal and Wright (Second edition, 2006).
Assembly: Microsoft.ML.Probabilistic.dll
Syntax
Constructors
BFGS()
Declaration
Fields
cancel
Declaration
Field Value
convergenceCriteria
Declaration
public BFGS.ConvergenceCriteria convergenceCriteria
Field Value
currentDeriv
Declaration
protected Vector currentDeriv
Field Value
currentObj
Declaration
protected double currentObj
Field Value
currentX
Declaration
protected Vector currentX
Field Value
debug
Whether to output debug info
Declaration
Field Value
dimension
Following fields are set up by the main run
routine, and are used to provide the 1-D function that
the line search needs
Declaration
Field Value
epsilon
Declaration
Field Value
feval
Declaration
protected FunctionEval feval
Field Value
initialStep
Declaration
protected double initialStep
Field Value
iter
Declaration
Field Value
lineSearch
Declaration
public LineSearch lineSearch
Field Value
maxIterations
Declaration
protected int maxIterations
Field Value
searchDir
Declaration
protected Vector searchDir
Field Value
stepMax
Declaration
Field Value
Properties
Cancel
Declaration
public bool Cancel { get; set; }
Property Value
Epsilon
Declaration
public double Epsilon { get; set; }
Property Value
InitialStep
Declaration
public double InitialStep { get; set; }
Property Value
Number of iterations performed to reach convergence (or failure)
Declaration
public int IterationsPerformed { get; }
Property Value
linesearchDebug
Whether to debug the line search
Declaration
public bool linesearchDebug { set; }
Property Value
MaximumIterations
Maximum number of iterations
Declaration
public int MaximumIterations { get; set; }
Property Value
MaximumStep
Declaration
public double MaximumStep { get; set; }
Property Value
Methods
LSEval(Double, Boolean, out Double)
This is the 1-D function that the line search sees.
The Run function will set up the necessary fields
Declaration
protected virtual double LSEval(double step, bool calcDeriv, out double deriv)
Parameters
Type |
Name |
Description |
Double |
step |
step
|
Boolean |
calcDeriv |
flag to calculate derivative
|
Double |
deriv |
the derivative
|
Returns
RaiseIterationEvent(Int32, Double, Double)
Safely invoke the iteration event
Declaration
protected void RaiseIterationEvent(int iteration, double objVal, double rmsDeriv)
Parameters
Run(Vector, Double, FunctionEval)
Run an unconstrained minimization using BFGS
Declaration
public virtual Vector Run(Vector x0, double normOfFirstStep, FunctionEval func)
Parameters
Type |
Name |
Description |
Vector |
x0 |
Starting step
|
Double |
normOfFirstStep |
Norm of first step
|
FunctionEval |
func |
Multivariate function and derivative evaluator
|
Returns
Type |
Description |
Vector |
The local minimum point
|
SetWolfeConstants(Double, Double)
Declaration
public void SetWolfeConstants(double c1, double c2)
Parameters
Type |
Name |
Description |
Double |
c1 |
Sufficient decrease condition
|
Double |
c2 |
Curvature condition
|
TryLineSearch(Double, Double, Double)
Declaration
protected double TryLineSearch(double s0, double smax, double currentGrad)
Parameters
Returns
Events
OnIteration
Event triggered at each iteration
Declaration
public event IterationEventHandler OnIteration
Event Type