I added the idea of a text output of gradients as <a href="http://www.admb-project.org/redmine/issues/109">Issue #109</a>, but don't have time or skill to figure out how to do this myself.<div><br><div class="gmail_quote">
On Sun, Oct 21, 2012 at 9:40 PM, Mark Maunder <span dir="ltr"><<a href="mailto:mmaunder@iattc.org" target="_blank">mmaunder@iattc.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">






<div lang="EN-US" link="blue" vlink="purple">
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">See below<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Liz Brooks [mailto:<a href="mailto:liz.brooks@noaa.gov" target="_blank">liz.brooks@noaa.gov</a>]
<br>
<b>Sent:</b> Thursday, October 11, 2012 11:19 AM<br>
<b>To:</b> Mark Maunder<br>
<b>Subject:</b> Re: your post about admb convergence<u></u><u></u></span></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal" style="margin-bottom:12.0pt">hi mark,<br>
<br>
thanks for the reply to my question.  it was motivated by a more generic question about whether one can simply look at the gradient and assert that a model has or hasn't converged.  even if the magnitude is not 1e+18 (as in the example online), but say rather
 that 98% of the parameters have a final gradient between 0.1 and 10, i would argue that one can conclude the model has not converged, particularly when the additional screen info indicates the model cannot improve and is exceeding the number of iterations,
 and the user-defined convergence criteria is 1e-5.  you may or may not want to weigh in on this more general question, but feel free to.<br>
<br>
related to this point, i have a pretty brute force way of saving the final matrix of gradients by saving a screen dump in R and then parsing all of that saved text into a matrix.  who would i have to make a request to at 'ADMB Headquarters' to have the final
 gradient information printed to a text file?  <br>
<br>
cheers, and thanks again,<br>
liz<br>
<br>
<u></u><u></u></p>
<div>
<p class="MsoNormal">On Thu, Oct 11, 2012 at 1:35 PM, Mark Maunder <<a href="mailto:mmaunder@iattc.org" target="_blank">mmaunder@iattc.org</a>> wrote:<u></u><u></u></p>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Liz,</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">That model has definitely not converged due to the high gradient. This type of very high gradient
 is usually caused by using the  += sign to assign something to the objective function without setting the objective function (or some other parameter, i.e. something used in the posfun function)  to zero at the start of the procedure section.</span><u></u><u></u></p>

<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Regards,</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Mark</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p>
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Liz Brooks [mailto:<a href="mailto:liz.brooks@noaa.gov" target="_blank">liz.brooks@noaa.gov</a>]
<br>
<b>Sent:</b> Thursday, October 11, 2012 6:58 AM<br>
<b>To:</b> Mark Maunder<br>
<b>Subject:</b> your post about admb convergence</span><u></u><u></u></p>
<div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal" style="margin-bottom:12.0pt">hi mark,<br>
<br>
i was reading through some of the replies to questions on the ADMB website pages, and saw this one that both you and dave had replied to.  not sure if you remember it.  i noticed that the convergence criterion specified was 1 e-12, yet all of the gradients
 are enormous (5.7e+18 is the largest, 1e+6 is the smallest).  the minimization obviously stopped because it exceeded the number of function evaluations and wasn't making progress:<br>
ic > imax  in fminim is answer attained ?<br>
<br>
however, if one notes the magnitudes of the gradients, wouldn't you conclude that the model had not attained a minimum?  i've pasted the screed dump from the original question below (and the weblink).  i'm curious how the gradients can be so large yet, as i
 understand the thread, the parameter estimates were at the "true" solution values.  seems paradoxical.  do you have any insights? 
<br>
<br>
thanks<br>
liz<br>
<br>
<br>
<a href="https://groups.google.com/forum/?fromgroups=#%21topic/admb-users/74AA16IWQNk" target="_blank">https://groups.google.com/forum/?fromgroups=#!topic/admb-users/74AA16IWQNk</a><br>
<span style="color:#00681c">Sylvain Bonhommeau</span><br>
<br>
25 variables; iteration 740; function evaluation 907<br>
Function value  -2.7878808e+05; maximum gradient component mag   5.7352e+18<br>
Var   Value    Gradient   |Var   Value    Gradient   |Var   Value    Gradient   <br>
  1-36.23879  4.58537e+02 |  2  0.00190 -3.50573e+18 |  3  1.30460  2.70468e+16<br>
  4  1.37629  7.65838e+15 |  5  0.01472  5.73518e+18 |  6  0.00288  1.15859e+18<br>
  7 -0.03205  1.47477e+17 |  8 -0.52865 -4.26941e+14 |  9 -0.52865  1.04332e+15<br>
 10 -1.47135 -6.57274e+14 | 11  0.12112 -1.61428e+16 | 12  0.16213 -2.80633e+16<br>
 13  0.08573 -1.75030e+16 | 14 -0.00369 -1.96681e+16 | 15 -0.21428  7.12243e+15<br>
 16-11.81483  1.82708e+14 | 17  4.18517  2.72772e+14 | 18  1.81483  3.84233e+13<br>
 19  0.21166  3.25505e+13 | 20  0.09244  1.03861e+16 | 21  0.05250  1.08502e+15<br>
 22  0.26054  2.77481e+15 | 23  0.78956 -9.50897e+13 | 24 210.1177  2.82176e+09<br>
 25 227.8695 -9.76063e+06 |<br>
  ic > imax  in fminim is answer attained ?<br>
Var   Value    Gradient   |Var   Value    Gradient   |Var   Value    Gradient   <br>
  1-36.23882  4.58537e+02 |  2  0.00190 -3.50573e+18 |  3  1.30460  2.70468e+16<br>
  4  1.37629  7.65838e+15 |  5  0.01472  5.73518e+18 |  6  0.00288  1.15859e+18<br>
  7 -0.03205  1.47477e+17 |  8 -0.52865 -4.26941e+14 |  9 -0.52865  1.04332e+15<br>
 10 -1.47135 -6.57274e+14 | 11  0.12112 -1.61428e+16 | 12  0.16213 -2.80633e+16<br>
 13  0.08573 -1.75030e+16 | 14 -0.00369 -1.96681e+16 | 15 -0.21428  7.12243e+15<br>
 16-11.81483  1.82708e+14 | 17  4.18517  2.72772e+14 | 18  1.81483  3.84233e+13<br>
 19  0.21166  3.25505e+13 | 20  0.09244  1.03861e+16 | 21  0.05250  1.08502e+15<br>
 22  0.26054  2.77481e+15 | 23  0.78956 -9.50897e+13 | 24 210.1177  2.82176e+09<br>
 25 227.8695 -9.76063e+06 |<br>
Function minimizer not making progress ... is minimum attained?<br>
Minimprove criterion =   0.0000e+00<br>
<br>
 - final statistics:<br>
25 variables; iteration 741; function evaluation 937<br>
Function value  -2.7879e+05; maximum gradient component mag   5.7352e+18<br>
Exit code = 1;  converg criter   1.0000e-12<br>
Var   Value    Gradient   |Var   Value    Gradient   |Var   Value    Gradient   <br>
  1-36.23882  4.58537e+02 |  2  0.00190 -3.50573e+18 |  3  1.30460  2.70468e+16<br>
  4  1.37629  7.65838e+15 |  5  0.01472  5.73518e+18 |  6  0.00288  1.15859e+18<br>
  7 -0.03205  1.47477e+17 |  8 -0.52865 -4.26941e+14 |  9 -0.52865  1.04332e+15<br>
 10 -1.47135 -6.57274e+14 | 11  0.12112 -1.61428e+16 | 12  0.16213 -2.80633e+16<br>
 13  0.08573 -1.75030e+16 | 14 -0.00369 -1.96681e+16 | 15 -0.21428  7.12243e+15<br>
 16-11.81483  1.82708e+14 | 17  4.18517  2.72772e+14 | 18  1.81483  3.84233e+13<br>
 19  0.21166  3.25505e+13 | 20  0.09244  1.03861e+16 | 21  0.05250  1.08502e+15<br>
 22  0.26054  2.77481e+15 | 23  0.78956 -9.50897e+13 | 24 210.1177  2.82176e+09<br>
 25 227.8695 -9.76063e+06 |<span class="HOEnZb"><font color="#888888"><br clear="all">
<br>
-- <br>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
<br>
Liz Brooks, PhD<br>
Operations Research Analyst<br>
NOAA/NMFS<br>
Northeast Fisheries Science Center<br>
166 Water Street                       phone: <a href="tel:508.495.2238" value="+15084952238" target="_blank">508.495.2238</a><br>
Woods Hole, MA  02543             fax: <a href="tel:508.495.2393" value="+15084952393" target="_blank">508.495.2393</a><br>
<br>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<u></u><u></u></font></span></p><span class="HOEnZb"><font color="#888888">
</font></span></div><span class="HOEnZb"><font color="#888888">
</font></span></div><span class="HOEnZb"><font color="#888888">
</font></span></div><span class="HOEnZb"><font color="#888888">
</font></span></div><span class="HOEnZb"><font color="#888888">
</font></span></div><span class="HOEnZb"><font color="#888888">
<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
<br clear="all">
<br>
-- <br>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
<br>
Liz Brooks, PhD<br>
Operations Research Analyst<br>
NOAA/NMFS<br>
Northeast Fisheries Science Center<br>
166 Water Street                       phone: <a href="tel:508.495.2238" value="+15084952238" target="_blank">508.495.2238</a><br>
Woods Hole, MA  02543             fax: <a href="tel:508.495.2393" value="+15084952393" target="_blank">508.495.2393</a><br>
<br>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<u></u><u></u></p>
</font></span></div>
</div>

<br>_______________________________________________<br>
Developers mailing list<br>
<a href="mailto:Developers@admb-project.org">Developers@admb-project.org</a><br>
<a href="http://lists.admb-project.org/mailman/listinfo/developers" target="_blank">http://lists.admb-project.org/mailman/listinfo/developers</a><br>
<br></blockquote></div><br></div>