forum.alglib.net

ALGLIB forum
It is currently Sun Dec 22, 2024 2:26 pm

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  [ 8 posts ] 
Author Message
 Post subject: How do I know what step size the LBFGS algorithm is taking
PostPosted: Tue Nov 05, 2013 12:11 am 
Offline

Joined: Tue Nov 05, 2013 12:07 am
Posts: 5
Hello everyone,
I would like to know if there is a possibility that I can know what step size the LBFGS algorithm is deciding on taking ? I know I can set the maximum step size but I will like to know specifically what is the step size its taking and if it also possible to get the Hessian matrix as output ?


On an unrelated topic, I was wondering if I can somehow trick teh algorithm to perform like steepest descent ? If someone knows any other good library for steepest descent please suggest

Thanks
Vikash


Top
 Profile  
 
 Post subject: Re: How do I know what step size the LBFGS algorithm is taki
PostPosted: Tue Nov 05, 2013 1:27 pm 
Offline
Site Admin

Joined: Fri May 07, 2010 7:06 am
Posts: 927
1. you may call minlbfgssetxrep(...,true) to turn on reports about algorithm progress, and then you will be able to compare current point with last one reported by algorithm (last point for which algorithm accepted step).

2. it is impossible to return Hessian matrix, algorithm does not evaluate it explicitly.

3. in order to get steepest descent, you may use MinCG subpackage, and manually rewrite it a bit. Find lines below "// Choose BetaK" comment, and rewrite them by "betak = 0.0". It will force CG algorithm to behave like steepest descent.

Or, alternatively, you may add your own value for State.CGType field (you will understand what I mean if you look at this piece of code) - say, CGtype=-1, which will denote "steepest descent" - and add "if( state.cgtype==-1 ) betak = 0;". So you will be able to have both steepest descent and unmodified CG algorithm.


Top
 Profile  
 
 Post subject: Re: How do I know what step size the LBFGS algorithm is taki
PostPosted: Tue Nov 05, 2013 4:01 pm 
Offline

Joined: Tue Nov 05, 2013 12:07 am
Posts: 5
Hello,
I understand that the library probably is not computing the Hessian explicitly. However, it will be nice to know what kind of estimation it is using, for example if it is using the Sherman-Morrison-Woodbery to estimate the Hessian.
Quote:
3. in order to get steepest descent, you may use MinCG subpackage, and manually rewrite it a bit. Find lines below "// Choose BetaK" comment, and rewrite them by "betak = 0.0". It will force CG algorithm to behave like steepest descent.

In this case I opened the optimization.cpp I found these lines
Code:
        if( state->cgtype==0 )
        {
            betak = state->betady;
        }
        if( state->cgtype==1 )
        {
            betak = ae_maxreal(0, ae_minreal(state->betady, state->betahs, _state), _state);
        }

I added
Code:
if (state->cgtype == -1)
betak =0;

below this.

However when I run the code it gives me malloc errors
*** glibc detected *** "path": malloc(): memory corruption: 0x0000000001b681a0 ***


Thanks a lot
Vikash


Top
 Profile  
 
 Post subject: Re: How do I know what step size the LBFGS algorithm is taki
PostPosted: Tue Nov 05, 2013 8:07 pm 
Offline
Site Admin

Joined: Fri May 07, 2010 7:06 am
Posts: 927
Hmmm.... strange. I have to check it myself. i will get back to you tomorrow.


Top
 Profile  
 
 Post subject: Re: How do I know what step size the LBFGS algorithm is taki
PostPosted: Tue Nov 05, 2013 8:17 pm 
Offline

Joined: Tue Nov 05, 2013 12:07 am
Posts: 5
Hi Sergey,
No its fine... I debugged, it was because I was writing
mincgcreate(1, x, state) Now it doesnt give that error anymore..
I am just concerned if setting betak =0 really makes it the classical steepest descent ?

Thanks
Vikash


Top
 Profile  
 
 Post subject: Re: How do I know what step size the LBFGS algorithm is taki
PostPosted: Wed Nov 06, 2013 7:18 am 
Offline
Site Admin

Joined: Fri May 07, 2010 7:06 am
Posts: 927
Hello! Thanks for info on the reasons behind failure.

Regarding steepest descent... Yes, it will be classical steepest descent (line search across gradient vector), assuming that: a) betak set to zero, b) preconditioning is turned off (you called minlbfgssetprecdiag() with unit vector as preconditioner).


Top
 Profile  
 
 Post subject: Re: How do I know what step size the LBFGS algorithm is taki
PostPosted: Sun Nov 10, 2013 6:14 pm 
Offline

Joined: Tue Nov 05, 2013 12:07 am
Posts: 5
Hi,
I am using minlbfgssetxrep(state ,1) . Still I dont get the step size. Can you tell me where it is stored as in state.xxx which gives the step size ?

Thanks
Vikash


Top
 Profile  
 
 Post subject: Re: How do I know what step size the LBFGS algorithm is taki
PostPosted: Mon Nov 10, 2014 5:55 am 
Offline

Joined: Mon Nov 10, 2014 5:51 am
Posts: 1
What compiler you used?

_________________
zoha


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 41 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