|
|
|||||||||||||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||||||||||||
java.lang.Objectde.lmu.ifi.dbs.elki.math.linearalgebra.fitting.LevenbergMarquardtMethod
public class LevenbergMarquardtMethod
Function parameter fitting using Levenberg-Marquardt method.
The Levenberg-Marquardt Algorithm (LMA) is a combination of the Gauss-Newton
Algorithm (GNA) and the method of steepest descent. As such it usually gives
more stable results and better convergence.
Implemented mostly based on:
Numerical Recipes In C: The Art Of Scientific Computing
ISBN 0-521-43108-5
Press, W.H. and Teukolsky, S.A. and Vetterling, W.T. and Flannery, B.P.
Cambridge University Press, Cambridge, Mass, 1992
TODO: Replace implementation by one based on
M.I.A. Lourakis levmar:
Levenberg-Marquardt nonlinear least squares algorithms in C/C++
Which supposedly offers increased robustness.
| Field Summary | |
|---|---|
private double[][] |
alpha
Working space for alphas |
private double[] |
beta
|
private double |
chisq
Chi-Squared information for parameters |
private double[][] |
covmat
Working space for covariance matrix |
private double[] |
deltaparams
|
private boolean[] |
dofit
Which parameters to fit |
FittingFunction |
func
Function to fit to |
private double |
lambda
Lambda (refinement step size) |
int |
maxruns
Maximum number of iterations in run() |
int |
maxsmall
Maximum number of small improvements (stopping condition) |
private int |
numfit
Number of parameters to fit |
private int |
numparams
Number of parameters |
private double[] |
params
Parameters to use in fitting |
private double[] |
paramstry
More working buffers |
private double[] |
s
|
double |
small
"Small value" condition for stopping |
private double[] |
x
Data to fit the function to |
private double[] |
y
|
| Constructor Summary | |
|---|---|
LevenbergMarquardtMethod(FittingFunction func,
double[] params,
boolean[] dofit,
double[] x,
double[] y,
double[] s)
Function fitting using Levenberg-Marquardt Method. |
|
| Method Summary | |
|---|---|
double |
getChiSq()
Get current ChiSquared (squared error sum) |
double[][] |
getCovmat()
Get the final covariance matrix. |
double[] |
getParams()
Get current parameters. |
void |
iterate()
Perform an iteration of the approximation loop. |
void |
run()
Iterate until convergence, at most 100 times. |
private double |
simulateParameters(double[] curparams)
Compute new chisquared error This function also modifies the alpha and beta matrixes! |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public FittingFunction func
private double[] x
private double[] y
private double[] s
private int numparams
private double[] params
private double chisq
private int numfit
private boolean[] dofit
private double[][] covmat
private double[][] alpha
private double lambda
private double[] paramstry
private double[] beta
private double[] deltaparams
public int maxruns
public int maxsmall
public double small
| Constructor Detail |
|---|
public LevenbergMarquardtMethod(FittingFunction func,
double[] params,
boolean[] dofit,
double[] x,
double[] y,
double[] s)
func - Function to fit tox - Measurement pointsy - Actual function valuess - Confidence / Variance in measurement dataparams - Initial parametersdofit - Flags on which parameters to optimize| Method Detail |
|---|
private double simulateParameters(double[] curparams)
curparams - Parameters to use in computation.
public void iterate()
public double[][] getCovmat()
public double[] getParams()
public double getChiSq()
public void run()
|
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||