BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
madix
Obsidian | Level 7

Hello,

 

I am doing a quasi newton optimization method but I have a problem. The optimization stop before I find the global maximum.

 

I wonder if I could use a termination criterion of 1e-4 in order to stop the optimization after getting an objective function as small as I want and if it is possible, how to do it?

 

Here is my code

proc iml;

         

     use a;

     read all var _NUM_ into data;

     close a;

 

  

     reset storage = &lib..myfunctions;

     load module=(function1 function2);  

    

     parameters = j(3, 1, .) ;

     parameters[1] = 1.1 ;    

           

    parameters[3]=0.5;

      

 

     con = {-10  1E-9, 10 1}

     opt = {1 4} ;       

    

    

     *Quasi-Newton Method ;

     call NLPQN(rc, parameters, "function1", theta, opt, con);

    

 

quit ;

 

 

Thank you for helping

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

There are multiple termination criteria that you can use. The documentation provides details. Common criteria include absolute function convergence criterion (ABSTOL, controlled by tc[3]) and absolute gradient convergence criterion (ABSGTOL, controlled by tc[6]). There are also "relative" versions of these criteria.

 

To use the termination criterion, allocate a vector of missing values (which means "use default values") and override the element that you want to control. For example,

 

tc = repeat(.,1,12);
tc[3] = 1.e-4;

call NLPQN(rc, parameters, "function1", theta, opt, con) tc=tc;

View solution in original post

1 REPLY 1
Rick_SAS
SAS Super FREQ

There are multiple termination criteria that you can use. The documentation provides details. Common criteria include absolute function convergence criterion (ABSTOL, controlled by tc[3]) and absolute gradient convergence criterion (ABSGTOL, controlled by tc[6]). There are also "relative" versions of these criteria.

 

To use the termination criterion, allocate a vector of missing values (which means "use default values") and override the element that you want to control. For example,

 

tc = repeat(.,1,12);
tc[3] = 1.e-4;

call NLPQN(rc, parameters, "function1", theta, opt, con) tc=tc;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

From The DO Loop
Want more? Visit our blog for more articles like these.
Discussion stats
  • 1 reply
  • 725 views
  • 0 likes
  • 2 in conversation