[Maxima-bugs] [ maxima-Bugs-2795799 ] lsquares_estimates_approximate ignores initial From: SourceForge.net - 2009-05-23 11:55:47 ```Bugs item #2795799, was opened at 2009-05-23 12:55 Message generated for change (Tracker Item Submitted) made by l_butler You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=2795799&group_id=4933 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Share Libraries Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Leo Butler (l_butler) Assigned to: Nobody/Anonymous (nobody) Summary: lsquares_estimates_approximate ignores initial Initial Comment: The following example is self-explanatory. >> load(lsquares)\$ >> M:matrix( [1900,75.995], [1910,91.972], [1920,105.711], [1930,123.203], [1940,131.669], [1950,150.697], [1960,179.323], [1970,203.212], [1980,226.505], [1990,249.633], [2000,281.422] )\$ mse:lsquares_mse(M,[x,y],y=a*exp(b*(x-1900))); ------------------------------------------------------------ The problem appears to be that lsquares_estimates_approximate ignores the initial value passed to it: lsquares_estimates_approximate(mse,'[a,b],initial=[82,0.01],iprint=[1,3]); ************************************************* VECTOR X= 1.000000000000000D+00 1.000000000000000D+00 GRADIENT VECTOR G= 1.313813415094471D+86 1.313813414823674D+88 You can see that the initial vector X is [1,1], although [82,0.01] is passed. The minimisation diverges because of the poor initial condiition. If you redefine mse so that [1,1] is a reasonable initial value, you will get an estimate: mse:subst([a=82*a,b=0.01*b],mse)\$ lsquares_estimates_approximate(mse,'[a,b],iprint=[1,3]); THE MINIMIZATION TERMINATED WITHOUT DETECTING ERRORS. IFLAG = 0 [[a = 1.005034579667296, b = 1.243184045872825]] ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=2795799&group_id=4933 ```
 [Maxima-bugs] [ maxima-Bugs-2795799 ] lsquares_estimates_approximate ignores initial From: SourceForge.net - 2009-05-23 17:51:15 ```Bugs item #2795799, was opened at 2009-05-23 12:55 Message generated for change (Comment added) made by l_butler You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=2795799&group_id=4933 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Share Libraries Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Leo Butler (l_butler) >Assigned to: Robert Dodier (robert_dodier) Summary: lsquares_estimates_approximate ignores initial Initial Comment: The following example is self-explanatory. >> load(lsquares)\$ >> M:matrix( [1900,75.995], [1910,91.972], [1920,105.711], [1930,123.203], [1940,131.669], [1950,150.697], [1960,179.323], [1970,203.212], [1980,226.505], [1990,249.633], [2000,281.422] )\$ mse:lsquares_mse(M,[x,y],y=a*exp(b*(x-1900))); ------------------------------------------------------------ The problem appears to be that lsquares_estimates_approximate ignores the initial value passed to it: lsquares_estimates_approximate(mse,'[a,b],initial=[82,0.01],iprint=[1,3]); ************************************************* VECTOR X= 1.000000000000000D+00 1.000000000000000D+00 GRADIENT VECTOR G= 1.313813415094471D+86 1.313813414823674D+88 You can see that the initial vector X is [1,1], although [82,0.01] is passed. The minimisation diverges because of the poor initial condiition. If you redefine mse so that [1,1] is a reasonable initial value, you will get an estimate: mse:subst([a=82*a,b=0.01*b],mse)\$ lsquares_estimates_approximate(mse,'[a,b],iprint=[1,3]); THE MINIMIZATION TERMINATED WITHOUT DETECTING ERRORS. IFLAG = 0 [[a = 1.005034579667296, b = 1.243184045872825]] ---------------------------------------------------------------------- >Comment By: Leo Butler (l_butler) Date: 2009-05-23 18:51 Message: Robert, In the documentation, the initial guess is specified by 'initial =' while in lsquares.mac, you use 'initial_guess'. If you change 'initial_guess' to 'initial', this fixes the problem -- Function: lsquares_estimates_approximate (, , initial = , tol = ) lsquares_estimates_approximate (MSE, parameters, [optional_args]) := block ([initial_guess : makelist (1, i, 1, length (parameters)), iprint : [1, 0], tol : 1e-3], with_parameters (optional_args, lbfgs (MSE, parameters, initial_guess, tol, iprint), [%%])); Leo ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=2795799&group_id=4933 ```
 [Maxima-bugs] [ maxima-Bugs-2795799 ] lsquares_estimates_approximate ignores initial From: SourceForge.net - 2009-07-28 00:21:21 ```Bugs item #2795799, was opened at 2009-05-23 05:55 Message generated for change (Comment added) made by robert_dodier You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=2795799&group_id=4933 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Share Libraries Group: None >Status: Closed >Resolution: Fixed Priority: 5 Private: No Submitted By: Leo Butler (l_butler) Assigned to: Robert Dodier (robert_dodier) Summary: lsquares_estimates_approximate ignores initial Initial Comment: The following example is self-explanatory. >> load(lsquares)\$ >> M:matrix( [1900,75.995], [1910,91.972], [1920,105.711], [1930,123.203], [1940,131.669], [1950,150.697], [1960,179.323], [1970,203.212], [1980,226.505], [1990,249.633], [2000,281.422] )\$ mse:lsquares_mse(M,[x,y],y=a*exp(b*(x-1900))); ------------------------------------------------------------ The problem appears to be that lsquares_estimates_approximate ignores the initial value passed to it: lsquares_estimates_approximate(mse,'[a,b],initial=[82,0.01],iprint=[1,3]); ************************************************* VECTOR X= 1.000000000000000D+00 1.000000000000000D+00 GRADIENT VECTOR G= 1.313813415094471D+86 1.313813414823674D+88 You can see that the initial vector X is [1,1], although [82,0.01] is passed. The minimisation diverges because of the poor initial condiition. If you redefine mse so that [1,1] is a reasonable initial value, you will get an estimate: mse:subst([a=82*a,b=0.01*b],mse)\$ lsquares_estimates_approximate(mse,'[a,b],iprint=[1,3]); THE MINIMIZATION TERMINATED WITHOUT DETECTING ERRORS. IFLAG = 0 [[a = 1.005034579667296, b = 1.243184045872825]] ---------------------------------------------------------------------- >Comment By: Robert Dodier (robert_dodier) Date: 2009-07-27 18:21 Message: Fixed by r1.8 share/contrib/lsquares.mac: changes initial_guess to initial. Closing this report as fixed. ---------------------------------------------------------------------- Comment By: Leo Butler (l_butler) Date: 2009-05-23 11:51 Message: Robert, In the documentation, the initial guess is specified by 'initial =' while in lsquares.mac, you use 'initial_guess'. If you change 'initial_guess' to 'initial', this fixes the problem -- Function: lsquares_estimates_approximate (, , initial = , tol = ) lsquares_estimates_approximate (MSE, parameters, [optional_args]) := block ([initial_guess : makelist (1, i, 1, length (parameters)), iprint : [1, 0], tol : 1e-3], with_parameters (optional_args, lbfgs (MSE, parameters, initial_guess, tol, iprint), [%%])); Leo ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=2795799&group_id=4933 ```