{"id":259,"date":"2017-09-07T00:01:35","date_gmt":"2017-09-06T14:01:35","guid":{"rendered":"https:\/\/www.alexshoolman.com\/blog\/?p=259"},"modified":"2024-08-08T10:28:06","modified_gmt":"2024-08-08T00:28:06","slug":"what-gradient-descent-algorithms-should-i-use","status":"publish","type":"post","link":"https:\/\/www.alexshoolman.com\/blog\/2017\/09\/07\/what-gradient-descent-algorithms-should-i-use\/","title":{"rendered":"What Gradient Descent Algorithms Should I Use?"},"content":{"rendered":"<p>Are you working hard on your Machine Learning code but are ignoring your Gradient Descent algorithm? Your training times are likely suffering!<\/p>\n<p>While machine learning is used to solve some amazing problems it&#8217;s fascinating to learn how they narrow in on the solutions. For us humans you might think of this related to any problem, say throwing a ball into a basketball ring.<\/p>\n<p>You throw the ball and it might sail over the ring missing it. Try again and this time there&#8217;s not enough power so it falls short. So on and so forth. Eventually you throw the ball and after <em><strong>learning<\/strong><\/em> you score a point. What you just did was learn to complete a task (getting the ball in the ring) by trying and adjusting your next attempt accordingly.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-867 size-large\" src=\"https:\/\/www.alexshoolman.com\/blog\/wp-content\/uploads\/2017\/09\/Basketball-Ring-Compressed-1024x680.jpg\" alt=\"Gradient Descent Task\" width=\"750\" height=\"498\" title=\"\" srcset=\"https:\/\/www.alexshoolman.com\/blog\/wp-content\/uploads\/2017\/09\/Basketball-Ring-Compressed.jpg 1024w, https:\/\/www.alexshoolman.com\/blog\/wp-content\/uploads\/2017\/09\/Basketball-Ring-Compressed-300x199.jpg 300w, https:\/\/www.alexshoolman.com\/blog\/wp-content\/uploads\/2017\/09\/Basketball-Ring-Compressed-768x510.jpg 768w, https:\/\/www.alexshoolman.com\/blog\/wp-content\/uploads\/2017\/09\/Basketball-Ring-Compressed-360x240.jpg 360w\" sizes=\"auto, (max-width: 750px) 100vw, 750px\" \/><\/p>\n<p>You got closer and closer to completing the task as you narrowed in on what exactly it was you had to do. This is described as a &#8220;learning algorithm&#8221; in the machine world. There are\u00a0<em><strong>many\u00a0<\/strong><\/em>learning algorithms for many different tasks.<\/p>\n<p>Gradient Descent is one of the biggest ones and getting your head around it is very important.<\/p>\n<h3>Gradient Descent<\/h3>\n<p>Essentially gradient descent is a mathematical way of describing what any logical person might do.<\/p>\n<p>You try and complete the task. Then you test to see how close you were to achieving the task. Finally you try again but this time with your settings slightly changed towards the target. Then you repeat.<\/p>\n<p>So if you threw the basketball and it missed to the left, you&#8217;d change your throw to be more towards the right. Easy!<\/p>\n<p>However just like with many other things in Machine Learning, it gets\u00a0<em><strong>much more complicated!<\/strong><\/em> An excellent source of information to further explain this and many other forms of Gradient Descent is\u00a0<a href=\"http:\/\/ruder.io\/optimizing-gradient-descent\/\" target=\"_blank\" rel=\"noopener\">Sebastian Ruder&#8217;s Overview post<\/a>.<\/p>\n<p>In it he goes through <em><strong>all the most popular<\/strong><\/em> versions and not only explains how they work, but why they are good and bad. His hugely detailed piece culminates in a fantastic GIF of all the various versions competing in a race.<\/p>\n<div id=\"attachment_866\" style=\"width: 630px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-866\" class=\"size-full wp-image-866\" src=\"https:\/\/www.alexshoolman.com\/blog\/wp-content\/uploads\/2017\/09\/Gradient-Descent-Race.gif\" alt=\"Gradient Descent Race\" width=\"620\" height=\"480\" title=\"\"><p id=\"caption-attachment-866\" class=\"wp-caption-text\">Gradient Descent Race. Source: ruder.io<\/p><\/div>\n<p>Here you can see all the various versions starting off and going through their various tests. Eventually they all find their way to the star which represents the lowest error rate but at different speeds.<\/p>\n<p>The speed at which each of the versions reaches the star translates to faster network training times. So as you can imagine everyone wants to find the quickest way to find the lowest error rate and reduce training time.<\/p>\n<p>If you&#8217;re just beginning with Machine Learning, Deep Learning or Neural Nets it&#8217;s an excellent read. Even if you&#8217;ve been doing Machine Learning for a while it&#8217;s still a great resource so you know exactly which version to use for various cases. You might even learn of a faster version you&#8217;ve been neglecting!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Are you working hard on your Machine Learning code but are ignoring your Gradient Descent algorithm? Your training times are likely suffering! While machine learning is used to solve some amazing problems it&#8217;s fascinating to learn how they narrow in on the solutions. For us humans you might think of [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":860,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[40],"tags":[25],"class_list":["post-259","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ai-robotics","tag-machine-learning"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/www.alexshoolman.com\/blog\/wp-content\/uploads\/2030\/08\/Mountains-Compressed.jpg","jetpack_shortlink":"https:\/\/wp.me\/p92j6e-4b","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.alexshoolman.com\/blog\/wp-json\/wp\/v2\/posts\/259","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.alexshoolman.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.alexshoolman.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.alexshoolman.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.alexshoolman.com\/blog\/wp-json\/wp\/v2\/comments?post=259"}],"version-history":[{"count":6,"href":"https:\/\/www.alexshoolman.com\/blog\/wp-json\/wp\/v2\/posts\/259\/revisions"}],"predecessor-version":[{"id":4882,"href":"https:\/\/www.alexshoolman.com\/blog\/wp-json\/wp\/v2\/posts\/259\/revisions\/4882"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.alexshoolman.com\/blog\/wp-json\/wp\/v2\/media\/860"}],"wp:attachment":[{"href":"https:\/\/www.alexshoolman.com\/blog\/wp-json\/wp\/v2\/media?parent=259"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.alexshoolman.com\/blog\/wp-json\/wp\/v2\/categories?post=259"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.alexshoolman.com\/blog\/wp-json\/wp\/v2\/tags?post=259"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}