-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LM Algorithm: Unbounded lambda #49
Comments
Thank you for great suggestion! I'm with you on that.
Which do you prefer? Or if you have any other idea, then please let me know. |
I think the first solution is the better of the two, this gives advanced users more control over the algorithm. If the user doesn't need to use the functionality, then on the back end something as simple as a default value |
Thank you again for good comments! |
* Add methods to control `lambda` in LM method (#49)
* Add methods to control `lambda` in LM method (#49)
Completed! #[allow(non_snake_case)]
fn test_LM() {
let x = seq(0, 10, 0.1);
let p_true = vec![1.0, 2.0, 3.0];
let y = x.fmap(|t| p_true[0] * t.powi(2) + p_true[1] * t + p_true[2]);
let p_init = vec![1f64, 1f64, 1f64];
let data = hstack!(x, y);
let mut opt = Optimizer::new(data, f);
let p_est = opt
.set_init_param(p_init)
.set_max_iter(50)
.set_method(LevenbergMarquardt)
.set_lambda_init(1e-3)
.set_lambda_max(1e+3)
.optimize();
p_est.print();
}
fn f(x: &Vec<f64>, p: Vec<AD>) -> Option<Vec<AD>> {
Some (
x.iter()
.map(|t| AD1(*t, 0f64))
.map(|t| p[0] * t.powi(2) + p[1] * t + p[2])
.collect()
)
} If lambda exceeds lambda_max then iteration is stopped and print iteration information. Caution: At 31-th iter, lambda exceeds max value: 12122.73120743323 |
I have some optimisations which appear to get caught in a local minimum so that
chi = chi_2
and as a resultrho = 0
. In the current setup, the algorithm doubleslambda
until there is some improvement, this seems to lead to divergence and the algorithm failing for some optimisation problems. A simple fix might be to have the algorithm halt whenlambda
exceeds a meaningful value.The text was updated successfully, but these errors were encountered: