forum.alglib.net

ALGLIB forum
It is currently Sun Dec 22, 2024 9:03 am

All times are UTC


Forum rules


1. This forum can be used for discussion of both ALGLIB-related and general numerical analysis questions
2. This forum is English-only - postings in other languages will be removed.



Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Help: an example code need
PostPosted: Wed Jul 28, 2010 9:35 am 
Offline

Joined: Wed Jul 28, 2010 9:30 am
Posts: 1
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...


Top
 Profile  
 
 Post subject: Re: Help: an example code need
PostPosted: Wed Jul 28, 2010 8:20 pm 
Offline
Site Admin

Joined: Fri May 07, 2010 7:06 am
Posts: 927
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).


Top
 Profile  
 
 Post subject: Re: Help: an example code need
PostPosted: Mon Sep 06, 2010 4:11 pm 
Offline

Joined: Mon Sep 06, 2010 4:04 pm
Posts: 2
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


Top
 Profile  
 
 Post subject: Re: Help: an example code need
PostPosted: Mon Sep 06, 2010 4:59 pm 
Offline
Site Admin

Joined: Fri May 07, 2010 7:06 am
Posts: 927
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.


Top
 Profile  
 
 Post subject: Re: Help: an example code need
PostPosted: Sun Sep 12, 2010 1:29 am 
Offline

Joined: Sun May 16, 2010 11:42 pm
Posts: 63
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)

_________________
Doug Jenkins
http://newtonexcelbach.wordpress.com/


Top
 Profile  
 
 Post subject: Re: Help: an example code need
PostPosted: Sun Sep 12, 2010 10:14 am 
Offline

Joined: Mon Sep 06, 2010 4:04 pm
Posts: 2
Many thanks for both replies, Much appreciated!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 47 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group