0

I'm trying to figure out a way how to optimize a function in Java, however, I'm struggling to do this.

I've found the Apache Math library, but I somehow cannot come up with a implementation that suits my problem. What I want to achieve is an optimization of the parameters alpha, beta and gamma in the equation of Triple Exponential Smoothing.

Do I have to calculate the derivatives of the equation? Or is there a way where I can simply state the formula in combination with parameters?

I'd love to see a rather simple example on how to optimize a simpler equation using a Marquardt optimizer (e.g., how to optimize Single Exponential Smoothing as I could do that by myself calculating the mean squared errors).

I'd appreciate some help. Thank you!

Community
  • 1
  • 1
Cr0w3
  • 120
  • 10
  • 1
    Are the remaining values given (except alpha, beta, gamma)? This case looks like a linear problem (haven't checked thoroughly) and you won't need numerical optimization. The parameters can even be calculated independently. – Nico Schertler Sep 07 '15 at 18:14
  • I'd love any tips regarding the needed calculation. If you could help me I'd be very grateful. Yes, the other numbers are given or have to be calculated. I understand how I could optimize the basic equation with one parameter (just a MSE over different parameter settings), but once I have more than one I don't know how I could find a good estimation (try different settings, yes, but with three different variables that could prove troublesome and would take some time). – Cr0w3 Sep 07 '15 at 19:12
  • Could you please explain, what you're given and what you want to optimize? – Nico Schertler Sep 07 '15 at 20:00
  • This [example](http://www.itl.nist.gov/div898/handbook/pmc/section4/pmc436.htm) shows what Triple Exponential Smoothing does. So, I have all the given values (in the example the quarterly sales values) and I can calculate b0 by estimating it (the equation with 1/L * (...)) as well as I0. What I want to do is to find the parameters that result in the least mean of squares errors (as it is done in the example as well). So calculating the first n results again and again (with different alpha, beta and gamma) until I get the best result for them. I hope I could make it clearer to you :/ – Cr0w3 Sep 07 '15 at 20:17
  • 1
    Ok, it seems to be non-linear then. From a first look, the apache math library seems to require the Jacobian matrix. You can try to calculate that but it might turn out to be quite complex. Instead, a library that supports finite differences would be more convenient. I usually use [LevMar](http://users.ics.forth.gr/~lourakis/levmar/) for this task. It is a C library, but you should be able to access it from Java through JNI. LevMar lets you specify a function (which would be your definition from the link) and the target values. it then optimizes for the parameters. – Nico Schertler Sep 08 '15 at 11:30
  • Thank you! :) I will look into it and ask if any further questions come up. – Cr0w3 Sep 08 '15 at 11:32

0 Answers0