public class NewtonRaphsonOptimizer extends AbstractOptimizer
AbstractOptimizer.LineSearchMethod, AbstractOptimizer.OptimizationException
Modifier and Type | Field and Description |
---|---|
protected double |
gradientCriterion |
static java.lang.String |
InnerIterationStarted |
protected int |
maxNumberOfIterations |
protected boolean |
verbose |
betaVector, convergenceAchieved, convergenceCriterion, hessianMatrix, optimalValue
Constructor and Description |
---|
NewtonRaphsonOptimizer() |
Modifier and Type | Method and Description |
---|---|
protected double |
calculateConvergence(Matrix gradient,
Matrix hessian,
double llk)
This method returns a double that is the convergence indicator based on the gradient, the hessian and the value of the log-likelihood function.
|
int |
getNumberOfIterations()
This method returns the number of iterations to reach convergence.
|
boolean |
optimize(AbstractMathematicalFunction function,
java.util.List<java.lang.Integer> indicesOfParametersToOptimize)
This method optimizes the likelihood of the StatisticalModel instance.
|
protected double |
runInnerOptimisation(AbstractMathematicalFunction function,
java.util.List<java.lang.Integer> indicesOfParametersToOptimize,
Matrix originalBeta,
Matrix optimisationStep,
double previousLogLikelihood,
AbstractOptimizer.LineSearchMethod lineSearchMethod)
This method optimize the log-likelihood function using the Newton-Raphson optimisation step.
|
void |
setVerbose(boolean verbose)
This method enables the verbose, i.e.
|
addOptimizerListener, fireOptimizerEvent, getConvergenceCriterion, getHessianAtMaximum, getOptimalValue, getParametersAtMaximum, isConvergenceAchieved, isVerboseEnabled, removeOptimizerListener, setConvergenceCriterion, setVerboseEnabled, toString
public static final java.lang.String InnerIterationStarted
protected boolean verbose
protected int maxNumberOfIterations
protected double gradientCriterion
protected double runInnerOptimisation(AbstractMathematicalFunction function, java.util.List<java.lang.Integer> indicesOfParametersToOptimize, Matrix originalBeta, Matrix optimisationStep, double previousLogLikelihood, AbstractOptimizer.LineSearchMethod lineSearchMethod) throws AbstractOptimizer.OptimizationException
function
- an AbstractMathematicalFunction instanceindicesOfParametersToOptimize
- a list of the indices of the parameters to be optimizedoriginalBeta
- the vector that contains the parameters of the previous outer optimisationoptimisationStep
- the optimisation step from the Newton-Raphson algorithmpreviousLogLikelihood
- the value of the log-likelihood function in the last outer optimisationlineSearchMethod
- OptimisationException
- if the inner optimisation is not successfulAbstractOptimizer.OptimizationException
public boolean optimize(AbstractMathematicalFunction function, java.util.List<java.lang.Integer> indicesOfParametersToOptimize) throws AbstractOptimizer.OptimizationException
AbstractOptimizer
optimize
in class AbstractOptimizer
function
- a AbstractMathematicalFunction objectindicesOfParametersToOptimize
- a List instance that contains the indices of the parameters to be optimizedAbstractOptimizer.OptimizationException
protected double calculateConvergence(Matrix gradient, Matrix hessian, double llk)
gradient
- a Matrix instancehessian
- a Matrix instancellk
- a double that is the value of the log-likelihood functionpublic int getNumberOfIterations()
public void setVerbose(boolean verbose)
verbose
- a boolean