{"id":129,"date":"2015-07-01T02:29:06","date_gmt":"2015-07-01T02:29:06","guid":{"rendered":"https:\/\/mgric.wordpress.com\/?p=129"},"modified":"2015-11-05T00:45:46","modified_gmt":"2015-11-05T00:45:46","slug":"gradient-search-methods-steepest-decent","status":"publish","type":"post","link":"https:\/\/marcelloricottone.com\/blog\/2015\/07\/01\/gradient-search-methods-steepest-decent\/","title":{"rendered":"Gradient Search Methods: Steepest Descent\u00a0Part 1"},"content":{"rendered":"<p>If you have been following along we have worked through a bunch of one dimensional search methods. However, what happens when we need to perform a search on multiple dinensions? \u00a0Well we need a new search method that can be expanded to multiple variables while still finding a minimum (or maximum).<\/p>The method should work similar to our previous methods. However, it should be applicable up to n variable. With this in mind we set out to design a search method. As we have seen before, we need two things for a successful search method. First we need to know where we are going (direction) and second we need to know how far to go in that direction (step size). With these two pieces of information we can go about finding our minimum (or maximum).<\/p>Let&#8217;s focus on the direction first. We want our function to decrease fastest on our chosen direction. If we look at a multi variable function which is both defined an differentiable in a small area around a point (otherwise known as a neighborhood), we find that the function decreases fastest along the negative gradient of the function. Let&#8217;s test this out.<\/p>Let&#8217;s take a simple multivariable function f(x,y) =\u00a0\u00a0x^2 -x+cos(y+x)+y^2. \u00a0Plotting this produces the following 3D graph and contour plot. Take notice of the Contour plot it will help us to determine our direction.<\/p><a href=\"http:\/\/marcelloricottone.com\/blog\/wp-content\/uploads\/2015\/07\/screen-shot-2015-06-30-at-9-39-18-pm.png\"><img loading=\"lazy\" decoding=\"async\" class=\"  wp-image-137 alignleft\" src=\"http:\/\/marcelloricottone.com\/blog\/wp-content\/uploads\/2015\/07\/screen-shot-2015-06-30-at-9-39-18-pm.png?w=300\" alt=\"Screen Shot 2015-06-30 at 9.39.18 PM\" width=\"326\" height=\"237\" srcset=\"https:\/\/marcelloricottone.com\/blog\/wp-content\/uploads\/2015\/07\/screen-shot-2015-06-30-at-9-39-18-pm.png 545w, https:\/\/marcelloricottone.com\/blog\/wp-content\/uploads\/2015\/07\/screen-shot-2015-06-30-at-9-39-18-pm-300x218.png 300w\" sizes=\"auto, (max-width: 326px) 100vw, 326px\" \/><\/a><img loading=\"lazy\" decoding=\"async\" class=\" size-medium wp-image-141 alignnone\" src=\"http:\/\/marcelloricottone.com\/blog\/wp-content\/uploads\/2015\/07\/screen-shot-2015-06-30-at-9-47-29-pm.png?w=300\" alt=\"Screen Shot 2015-06-30 at 9.47.29 PM\" width=\"300\" height=\"232\" srcset=\"https:\/\/marcelloricottone.com\/blog\/wp-content\/uploads\/2015\/07\/screen-shot-2015-06-30-at-9-47-29-pm.png 501w, https:\/\/marcelloricottone.com\/blog\/wp-content\/uploads\/2015\/07\/screen-shot-2015-06-30-at-9-47-29-pm-300x232.png 300w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>We have an infinite number of directions to move In but let&#8217;s choose four test cases. We will choose the gradient, the negative gradient, and two other directions. For our initial point lets choose (-6,8). This point lets use evaluate our gradient Mapping these directions (all with a step of 0.1 ) produces the following graph.<\/p><a href=\"http:\/\/marcelloricottone.com\/blog\/wp-content\/uploads\/2015\/07\/screen-shot-2015-06-30-at-10-26-20-pm.png\"><img loading=\"lazy\" decoding=\"async\" class=\" size-medium wp-image-142 aligncenter\" src=\"http:\/\/marcelloricottone.com\/blog\/wp-content\/uploads\/2015\/07\/screen-shot-2015-06-30-at-10-26-20-pm.png?w=300\" alt=\"Screen Shot 2015-06-30 at 10.26.20 PM\" width=\"300\" height=\"233\" srcset=\"https:\/\/marcelloricottone.com\/blog\/wp-content\/uploads\/2015\/07\/screen-shot-2015-06-30-at-10-26-20-pm.png 496w, https:\/\/marcelloricottone.com\/blog\/wp-content\/uploads\/2015\/07\/screen-shot-2015-06-30-at-10-26-20-pm-300x233.png 300w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>Now this isn&#8217;t a rigorous proof (or a particularly fantastic one) but as you can see our function is lowest in the direction of the negative gradient. As you can see the negative gradient line (magenta) points toward the center of the contour plot and to the lowest function evaluation. All other points are off center or in completely wrong directions. However, this only holds for a small neighborhood around our point. If we take too big a step then we might end up a wrong point or higher function evaluation. This brings us to our next requirement a step size. \u00a0There are a few ways to determine a step size. The two major ways are a static step size (kinda like how we reduced our interval in GSS), and a dynamically changing step size. Regardless of which we end up choosing lets represent the step size by rho,\u00a0\u03c1.<\/p>We now have our step size (\u03c1) and our direction (negative gradient). With this we can begin our search. With initial point &#8220;a&#8221; we evaluate the gradient. The gradient is then scaled by our step size and subtracted to from our initial point. This gives us our second point &#8220;b.&#8221; We then repeat this with point &#8220;b.&#8221; Evaluate the gradient, scale by the step size, subtract from point &#8220;b&#8221; to give us point &#8220;c&#8221;. This\u00a0is outlined below.<\/p><img loading=\"lazy\" decoding=\"async\" class=\"  wp-image-135 aligncenter\" src=\"http:\/\/marcelloricottone.com\/blog\/wp-content\/uploads\/2015\/06\/screen-shot-2015-06-30-at-7-22-50-pm.png?w=300\" alt=\"Screen Shot 2015-06-30 at 7.22.50 PM\" width=\"392\" height=\"256\" srcset=\"https:\/\/marcelloricottone.com\/blog\/wp-content\/uploads\/2015\/06\/screen-shot-2015-06-30-at-7-22-50-pm.png 433w, https:\/\/marcelloricottone.com\/blog\/wp-content\/uploads\/2015\/06\/screen-shot-2015-06-30-at-7-22-50-pm-300x196.png 300w\" sizes=\"auto, (max-width: 392px) 100vw, 392px\" \/><\/p>So you probably realized where we were headed. Following the steps above we have determined our iterative step. Like our previous one-dimensional search methods, our gradient search method iterates the above equation until a tolerance condition is met. The method described above is called the Method of Steepest Descent or Gradient Descent. Next Post we will go over the method with a real example.<\/p>-Marcello<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you have been following along we have worked through a bunch of one dimensional search methods. However, what happens when we need to perform a search on multiple dinensions? \u00a0Well we need a new search method that can be expanded to multiple variables while still finding a minimum (or maximum).The method should work similar&hellip; <\/p>\n<p class=\"toivo-read-more\"><a href=\"https:\/\/marcelloricottone.com\/blog\/2015\/07\/01\/gradient-search-methods-steepest-decent\/\" class=\"more-link\">Read more <span class=\"screen-reader-text\">Gradient Search Methods: Steepest Descent\u00a0Part 1<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,5,2],"tags":[],"class_list":{"0":"post-129","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-allposts","7":"category-gsm","8":"category-opt","9":"entry"},"_links":{"self":[{"href":"https:\/\/marcelloricottone.com\/blog\/wp-json\/wp\/v2\/posts\/129","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/marcelloricottone.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/marcelloricottone.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/marcelloricottone.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/marcelloricottone.com\/blog\/wp-json\/wp\/v2\/comments?post=129"}],"version-history":[{"count":1,"href":"https:\/\/marcelloricottone.com\/blog\/wp-json\/wp\/v2\/posts\/129\/revisions"}],"predecessor-version":[{"id":292,"href":"https:\/\/marcelloricottone.com\/blog\/wp-json\/wp\/v2\/posts\/129\/revisions\/292"}],"wp:attachment":[{"href":"https:\/\/marcelloricottone.com\/blog\/wp-json\/wp\/v2\/media?parent=129"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/marcelloricottone.com\/blog\/wp-json\/wp\/v2\/categories?post=129"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/marcelloricottone.com\/blog\/wp-json\/wp\/v2\/tags?post=129"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}