forum.alglib.net
http://forum.alglib.net/

Help: an example code need
http://forum.alglib.net/viewtopic.php?f=2&t=45
Page 1 of 1

Author:  manik [ Wed Jul 28, 2010 9:35 am ]
Post subject:  Help: an example code need

Hi Sergey,
Firstly,I would like to thank you for this library that you have developed.

I am looking to use levenberg marquardt optimization from the C# version of your library.
I am looking to do the following.
for a parameter set C (vector size 5).
for x values X(vector size 15+)
for y values Y(vector size 15+)
I have to min f(X,C)-Y
I dont have to gradient or jacobian or hessian of the function.

Please can you tell me which version of LMA to use, given that I can only provided for function values and not the derivatives.

Could not find a similar example in the examples provided with c# code.

Eagerly waiting.
Regards...

Author:  Sergey.Bochkanov [ Wed Jul 28, 2010 8:20 pm ]
Post subject:  Re: Help: an example code need

You have to provide at least jacobian (FJ scheme), otherwise it won't work. You can try numerical differentiation if you don't have analytic jacobian (use at least 4-point formula in such case).

Author:  michellergao [ Mon Sep 06, 2010 4:11 pm ]
Post subject:  Re: Help: an example code need

Hi Sergey

I would also like to say thank you for the library!

Just follow up from this thread, is this the case for all optimisation method currently in Alglib? minASA, minLM, minLBFGS, in all these cases, we need to provide the gradient function?

thank you

Author:  Sergey.Bochkanov [ Mon Sep 06, 2010 4:59 pm ]
Post subject:  Re: Help: an example code need

Yes, gradient is required in all cases. If you can't calculate it analytically, you can try to use difference formula. In this case use at least 4-point formula (6-point is even better).

I was thinking about supporting optimization of smooth functions without derivatives. Two features are likely to be introduced in the next versions of the library: a) symbolic differentiation for "simple" functions, and b) built-in differentiation using difference formulas. When I talk about symbolic differentiation, I mean something like

Code:
minlbfgsoptimize(state, "f(x,y,z)=exp(x^2)+(y-z)^2");


Of course, such interface will be intended (and efficient) only for simple functions.

Author:  Doug Jenkins [ Sun Sep 12, 2010 1:29 am ]
Post subject:  Re: Help: an example code need

Quote:
I was thinking about supporting optimization of smooth functions without derivatives. Two features are likely to be introduced in the next versions of the library: a) symbolic differentiation for "simple" functions, and b) built-in differentiation using difference formulas. When I talk about symbolic differentiation, I mean something like


That will be good. In the mean time the Excel VBA Evaluate function can be used to do the same thing. An example can be seen, using the ALGLIB integration functions to carry out numerical integration of functions entered as text on the spreadsheet, at this blog post:
http://newtonexcelbach.wordpress.com/20 ... functions/

The code that does the work is:
Code:
Do
' Replace the integration variable with the X value returned 
' by the FState function 
EStep = Replace(Func, IntA(1, 1), FState.X) 
' Evaluate the resulting expression 
FState.F = Evaluate(EStep) 
' Return to ALGLIB iteration function 
ItState = AutoGKIteration(FState) 
Loop While ItState = True
' When ItState is false retrieve the results 
Call AutoGKResults(FState, V, Rep)

Author:  michellergao [ Sun Sep 12, 2010 10:14 am ]
Post subject:  Re: Help: an example code need

Many thanks for both replies, Much appreciated!

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/