Interface UnconstrainedLeastSquares
-
- All Superinterfaces:
- IterativeOptimization, java.io.Serializable
- All Known Implementing Classes:
- LevenbergDampened_to_UnconstrainedLeastSquares, TrustRegionLeastSquares_to_UnconstrainedLeastSquares
public interface UnconstrainedLeastSquares extends IterativeOptimization
Non-linear least squares problems have a special structure which can be taken advantage of for optimization. The least squares problem is defined below:
F(x) = 0.5*sum( i=1:M ; fi(x)2 )
where fi(x) is a function from ℜN to ℜ. M is number of functions, and N is number of fit parameters. M ≥ N
fi(x) = observed - predicted, which is known as the residual error.Convergence is tested using the g-test, which is based off the gradient's norm.
G-test: gtol ≤ ||g(x)||inf
A relative f-test is not provided since that test breaks down when the expected function output is zero. An absolute f-test can be done by checking the value ofgetFunctionValue()in each iteration.NOTE: The function computes the M outputs of the fi(x), residual error functions, NOT [fi(x)]2
FORMATS:
Input functions are specified usingFunctionNtoMfor the set of M functions, andFunctionNtoMxNfor the Jacobian. The function's output is a vector of length M, where element i correspond to function i's output. The Jacobian is an array containing the partial derivatives of each function. Element J(i,j) corresponds to the partial of function i and parameter j. The array is stored in a row major format. The partial for F(i,j) would be stored at index = i*N+j in the data array.NOTE: If you need to modify the optimization parameters this can be done inside the 'function'.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description doublegetFunctionValue()Returns the value of the objective function being evaluated at the current parameters value.double[]getParameters()After each iteration this function can be called to get the current best set of parameters.voidinitialize(double[] initial, double ftol, double gtol)Specify the initial set of parameters from which to start from.voidsetFunction(FunctionNtoM function, FunctionNtoMxN jacobian)Specifies a set of functions and their Jacobian.-
Methods inherited from interface org.ddogleg.optimization.IterativeOptimization
getWarning, isConverged, isUpdated, iterate
-
-
-
-
Method Detail
-
setFunction
void setFunction(FunctionNtoM function, FunctionNtoMxN jacobian)
Specifies a set of functions and their Jacobian. See class description for documentation on output data format.- Parameters:
function- Computes the output of M functions fi(x) which take in N fit parameters as input.jacobian- Computes the Jacobian of the M functions. If null a numerical Jacobian will be used.
-
initialize
void initialize(double[] initial, double ftol, double gtol)Specify the initial set of parameters from which to start from. Call aftersetFunction(org.ddogleg.optimization.functions.FunctionNtoM, org.ddogleg.optimization.functions.FunctionNtoMxN)has been called.- Parameters:
initial- Initial parameters or guess with N elements..ftol- Relative threshold for change in function value between iterations. 0 ≤ ftol ≤ 1. Try 1e-12gtol- Absolute threshold for convergence based on the gradient's norm. 0 disables test. 0 ≤ gtol. Try 1e-12
-
getParameters
double[] getParameters()
After each iteration this function can be called to get the current best set of parameters.
-
getFunctionValue
double getFunctionValue()
Returns the value of the objective function being evaluated at the current parameters value. If not supported then an exception is thrown.- Returns:
- Objective function's value.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG