forum.alglib.net

ALGLIB forum
It is currently Sun Dec 22, 2024 1:10 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  [ 3 posts ] 
Author Message
 Post subject: Question about L-BFGS step
PostPosted: Wed Jan 13, 2016 5:21 pm 
Offline

Joined: Wed Jan 13, 2016 5:19 pm
Posts: 2
Dear alglib,

I have tried out the Python version of L-BFGS with numerical gradient for my maximum likelihood estimation. The algorithm performs well at the beginning, trying small steps. But in the later stage, it starts to try some parameters very far from the previous point, and leads to negative log likelihood going to infinity. Eventually the algorithm stops with the value that leads to -infinity. I have shown a snippet of the steps that switched from normal small step search to large step search below.

Is this happening because the gradient is too small for the algorithm to try something small? Does this mean this is near the optimum? How should I inform the algorithm that the step it is trying is not feasible and it should backtrack?

Thank you!
Henk

[Wed Jan 13 02:29:52 2016] Evaluating neg_llkd at:
mu_beta:
[-9.58362034 -2.41123789 -2.36222228 -2.3671299 -4.88157934 -2.81564508
-3.20954561 -1.28837444 -3.36283337 -4.74479617 -5.01694472 -3.69086546
-5.76013634 -3.50911833 -9.2103 -1.92538441 -2.67018378 -9.2103
-9.2103 -9.2103 -5.80543116 -4.56404266 -3.17869566]
mu_gamma:
[ 1.66905736 -4.51448085 -0.66986931 -5.12043919 -3.1935538
-2.00441952 -10.14119433]

[Wed Jan 13 02:29:52 2016] Negative log likelihood: 382907.12427123089, Elapsed time: 0.0127031803131

[Wed Jan 13 02:29:52 2016] Evaluating neg_llkd at:
mu_beta:
[-9.58362034 -2.41123789 -2.36222228 -2.3671299 -4.88157934 -2.81564508
-3.20954561 -1.28837444 -3.36283337 -4.74479617 -5.01694472 -3.69086546
-5.76013634 -3.50911833 -9.2103 -1.92538441 -2.67018378 -9.2103
-9.2103 -9.2103 -5.80543116 -4.56404266 -3.17869566]
mu_gamma:
[ 1.66905736 -4.51448085 -0.66986931 -5.12043919 -3.1935538
-2.00441952 -10.14119333]

[Wed Jan 13 02:29:52 2016] Negative log likelihood: 382907.12427041965, Elapsed time: 0.0131719112396

[Wed Jan 13 02:29:52 2016] Evaluating neg_llkd at:
mu_beta:
[-9.58362034 -2.41123789 -2.36222228 -2.3671299 -4.88157934 -2.81564508
-3.20954561 -1.28837444 -3.36283337 -4.74479617 -5.01694472 -3.69086546
-5.76013634 -3.50911833 -9.2103 -1.92538441 -2.67018378 -9.2103
-9.2103 -9.2103 -5.80543116 -4.56404266 -3.17869566]
mu_gamma:
[ 1.66905736 -4.51448085 -0.66986931 -5.12043919 -3.1935538
-2.00441952 -10.14119283]

[Wed Jan 13 02:29:52 2016] Negative log likelihood: 382907.12427001412, Elapsed time: 0.012629032135

[Wed Jan 13 02:29:52 2016] Evaluating neg_llkd at:
mu_beta:
[ 1213.79751302 -628.06688471 -2971.79368032 -2824.44542868 -15.01845319
-363.77978283 -230.9855427 -1131.82050822 -211.81809739 -122.89389138
-73.75904751 -277.33747764 -22.11033845 -36.7372429 -9.2103
-899.70579442 21.87460924 -9.2103 -9.2103 -9.2103
-12.52031543 3.8345176 -12.23877629]
mu_gamma:
[-22719.44879008 -184.51365897 -6175.16699133 -144.24854553
-403.43173915 2083.80874644 -9.32993425]

[Wed Jan 13 02:29:52 2016] Infeasible Parameters.

[Wed Jan 13 02:29:52 2016] Evaluating neg_llkd at:
mu_beta:
[ 1213.79751202 -628.06688471 -2971.79368032 -2824.44542868 -15.01845319
-363.77978283 -230.9855427 -1131.82050822 -211.81809739 -122.89389138
-73.75904751 -277.33747764 -22.11033845 -36.7372429 -9.2103
-899.70579442 21.87460924 -9.2103 -9.2103 -9.2103
-12.52031543 3.8345176 -12.23877629]
mu_gamma:
[-22719.44879008 -184.51365897 -6175.16699133 -144.24854553
-403.43173915 2083.80874644 -9.32993425]

[Wed Jan 13 02:29:52 2016] Infeasible Parameters.

[Wed Jan 13 02:29:52 2016] Evaluating neg_llkd at:
mu_beta:
[ 1213.79751252 -628.06688471 -2971.79368032 -2824.44542868 -15.01845319
-363.77978283 -230.9855427 -1131.82050822 -211.81809739 -122.89389138
-73.75904751 -277.33747764 -22.11033845 -36.7372429 -9.2103
-899.70579442 21.87460924 -9.2103 -9.2103 -9.2103
-12.52031543 3.8345176 -12.23877629]
mu_gamma:
[-22719.44879008 -184.51365897 -6175.16699133 -144.24854553
-403.43173915 2083.80874644 -9.32993425]

[Wed Jan 13 02:29:52 2016] Infeasible Parameters.


Top
 Profile  
 
 Post subject: Re: Question about L-BFGS step
PostPosted: Thu Jan 14, 2016 12:05 pm 
Offline
Site Admin

Joined: Fri May 07, 2010 7:06 am
Posts: 927
How exactly you determined that your function has "infeasible parameters"? I mean, what condition you used?

If your function has some kind of box constraint, some operation which relies on nonnegativity of its operands, etc, then optimizer may accidentally find this weak point and perform step deep into infeasible area. I see that after stepping far away, it performs small steps around "infeasible" point, so it still tries to optimize.

So, it may be optimizer problem - but may be problem with your function, some hidden instability. Say, like optimizing f=1/x+x^2. Everything is OK until you suddenly jump over x=0, and now you have problem which is unconstrained from below at x=0.


Top
 Profile  
 
 Post subject: Re: Question about L-BFGS step
PostPosted: Fri Jan 15, 2016 1:42 am 
Offline

Joined: Wed Jan 13, 2016 5:19 pm
Posts: 2
Dear Sergey,

Thank you for your reply! My parameters have sign constraints, so I need to exp the parameter before evaluating it in the likelihood function. By having the parameter value being around 2000, it is easy to detect infeasible parameter. I just tried to use 1e300 as the returned negative log likelihood, and it seems to have solved problem.

Best,
Henk


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

All times are UTC


Who is online

Users browsing this forum: Bing [Bot] and 16 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:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group