{"id":330,"date":"2019-04-08T01:32:41","date_gmt":"2019-04-08T01:32:41","guid":{"rendered":"http:\/\/freedville.com\/blog\/?p=330"},"modified":"2019-04-12T13:58:51","modified_gmt":"2019-04-12T13:58:51","slug":"use-this-one-simple-trick-to-understand-machine-learning","status":"publish","type":"post","link":"https:\/\/freedville.com\/blog\/2019\/04\/08\/use-this-one-simple-trick-to-understand-machine-learning\/","title":{"rendered":"Use this one simple trick to understand machine learning"},"content":{"rendered":"<p>Machine Learning is a lot like gravity in outer space. That&#8217;s the trick! Let me explain further how this analogy works.<\/p>\n<figure id=\"attachment_336\" aria-describedby=\"caption-attachment-336\" style=\"width: 400px\" class=\"wp-caption alignleft\"><img decoding=\"async\" loading=\"lazy\" class=\"wp-image-336\" src=\"http:\/\/freedville.com\/blog\/wp-content\/uploads\/2019\/04\/man_looking_at_stars-700x1050.jpeg\" alt=\"Man looking at a starry sky\" width=\"400\" height=\"600\" srcset=\"https:\/\/freedville.com\/blog\/wp-content\/uploads\/2019\/04\/man_looking_at_stars-700x1050.jpeg 700w, https:\/\/freedville.com\/blog\/wp-content\/uploads\/2019\/04\/man_looking_at_stars-200x300.jpeg 200w, https:\/\/freedville.com\/blog\/wp-content\/uploads\/2019\/04\/man_looking_at_stars-768x1152.jpeg 768w, https:\/\/freedville.com\/blog\/wp-content\/uploads\/2019\/04\/man_looking_at_stars.jpeg 800w\" sizes=\"(max-width: 400px) 100vw, 400px\" \/><figcaption id=\"caption-attachment-336\" class=\"wp-caption-text\">Photo by Klemen Vrankar on Unsplash<\/figcaption><\/figure>\n<p>We know that Machine Learning systems learn by example. We know they must be trained with varied and representative data since the only way to train and improve the system is through more and better training data.\u00a0 By learning from known-good, representative examples, the system learns to associate unseen examples with previously seen examples and thus can make useful predictions.<\/p>\n<p>We can build an analogy in the following way.\u00a0 Each piece of training data is a star and our machine learning model is the gravitational field of the universe.\u00a0 In space as well as in our example every galactic body has a gravitational pull on every other body.\u00a0\u00a0Further, as we add more training data (more stars) to our universe they start to form gravitational clusters &#8211; zones of similar bodies with a strong combined gravity.<\/p>\n<p>Thus, training a machine learning model is like dropping stars into space and letting them form gravitational clusters.<\/p>\n<figure id=\"attachment_335\" aria-describedby=\"caption-attachment-335\" style=\"width: 700px\" class=\"wp-caption alignleft\"><img decoding=\"async\" loading=\"lazy\" class=\"size-large wp-image-335\" src=\"http:\/\/freedville.com\/blog\/wp-content\/uploads\/2019\/04\/gravitational_clusters-700x466.jpeg\" alt=\"\" width=\"700\" height=\"466\" srcset=\"https:\/\/freedville.com\/blog\/wp-content\/uploads\/2019\/04\/gravitational_clusters-700x466.jpeg 700w, https:\/\/freedville.com\/blog\/wp-content\/uploads\/2019\/04\/gravitational_clusters-300x200.jpeg 300w, https:\/\/freedville.com\/blog\/wp-content\/uploads\/2019\/04\/gravitational_clusters-768x512.jpeg 768w, https:\/\/freedville.com\/blog\/wp-content\/uploads\/2019\/04\/gravitational_clusters-175x117.jpeg 175w, https:\/\/freedville.com\/blog\/wp-content\/uploads\/2019\/04\/gravitational_clusters.jpeg 800w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><figcaption id=\"caption-attachment-335\" class=\"wp-caption-text\">A galaxy is a gravitational cluster (Photo by Bryan Goff on Unsplash)<\/figcaption><\/figure>\n<p>We don&#8217;t create machine learning models for the thrill of setting up gravitational clusters &#8211; we create them to make predictions on data they have never been trained on, data they have never seen.\u00a0 Let&#8217;s add that to the analogy.<\/p>\n<p>Each piece of unseen data is like a tiny asteroid dropped into the system.\u00a0 A machine learning prediction is thus what gravitational cluster this little asteroid gets pulled to.\u00a0 Remember stars pull on asteroids &#8211; asteroids don&#8217;t pull on stars.\u00a0 \u00a0In a well trained machine model our unseen data asteroid will be gravitationally pulled to the correct gravitational cluster and our prediction will be made.<\/p>\n<figure id=\"attachment_338\" aria-describedby=\"caption-attachment-338\" style=\"width: 700px\" class=\"wp-caption alignleft\"><img decoding=\"async\" loading=\"lazy\" class=\"size-large wp-image-338\" src=\"http:\/\/freedville.com\/blog\/wp-content\/uploads\/2019\/04\/astronaut_float_in_space-700x700.jpg\" alt=\"Asteroid floating in space\" width=\"700\" height=\"700\" srcset=\"https:\/\/freedville.com\/blog\/wp-content\/uploads\/2019\/04\/astronaut_float_in_space-700x700.jpg 700w, https:\/\/freedville.com\/blog\/wp-content\/uploads\/2019\/04\/astronaut_float_in_space-150x150.jpg 150w, https:\/\/freedville.com\/blog\/wp-content\/uploads\/2019\/04\/astronaut_float_in_space-300x300.jpg 300w, https:\/\/freedville.com\/blog\/wp-content\/uploads\/2019\/04\/astronaut_float_in_space-768x768.jpg 768w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><figcaption id=\"caption-attachment-338\" class=\"wp-caption-text\">An asteroid, or astronaut, will pulled by the strongest gravitational body (Photo by NASA on Unsplash)<\/figcaption><\/figure>\n<p>Building on this analogy we can visualize additional key points relating to machine learning models:<\/p>\n<p><strong>You need enough data &#8211; both volume and variety.<\/strong>\u00a0 Without sufficient training data you can&#8217;t form gravitational clusters and thus unseen data won&#8217;t be pulled in the correct direction.\u00a0 (For more, see <a href=\"http:\/\/freedville.com\/blog\/2016\/12\/15\/why-does-machine-learning-require-so-much-training-data\/\">Why does machine learning require so much training data?<\/a>)<\/p>\n<p><strong>Bad (or non-representative) data hurts the model.<\/strong>\u00a0 Every piece of training data impacts the model through its gravitational pull.\u00a0 If you train the model on data that it will never see at runtime, predictions can still skew towards this non-representative data.\u00a0 I have seen several-percent accuracy improvements in models when non-representative data was removed from the training set.\u00a0 As popularized in the movie Gravity, space junk is deadly!<\/p>\n<p><strong>Real outer space isn&#8217;t static &#8211; and your model shouldn&#8217;t be either.<\/strong>\u00a0 This one is stretching our analogy a bit.\u00a0 Nevertheless, over time your original training data becomes less representative of the unseen data the model must predict.\u00a0 Thus your gravitational universe requires old stars to be removed and new stars to be added.\u00a0 This maintains the health of your machine learning model&#8217;s gravitational field.<\/p>\n<p>I hope this analogy helps you understand machine learning better!<\/p>\n<p>Footnote on the analogy:\u00a0 The actual math behind most machine learning models uses hundreds or thousands of dimensions and outer space only has three.\u00a0 Nonetheless, I find this an interesting way to think about machine learning.\u00a0 Note that his analogy works best for ML classifiers, but it&#8217;s still a workable analogy for other model types.\u00a0 (See more of my thoughts on classifiers at <a style=\"background-color: #ffffff;\" href=\"http:\/\/freedville.com\/blog\/2018\/06\/04\/cognitive-classification-and-what-it-can-do-for-you\/\">Cognitive classification and what it can do for you<\/a>).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Machine Learning is a lot like gravity in outer space. That&#8217;s the trick! Let me explain further how this analogy works. We know that Machine Learning systems learn by example. We know they must be&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[9,2],"_links":{"self":[{"href":"https:\/\/freedville.com\/blog\/wp-json\/wp\/v2\/posts\/330"}],"collection":[{"href":"https:\/\/freedville.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/freedville.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/freedville.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/freedville.com\/blog\/wp-json\/wp\/v2\/comments?post=330"}],"version-history":[{"count":7,"href":"https:\/\/freedville.com\/blog\/wp-json\/wp\/v2\/posts\/330\/revisions"}],"predecessor-version":[{"id":396,"href":"https:\/\/freedville.com\/blog\/wp-json\/wp\/v2\/posts\/330\/revisions\/396"}],"wp:attachment":[{"href":"https:\/\/freedville.com\/blog\/wp-json\/wp\/v2\/media?parent=330"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/freedville.com\/blog\/wp-json\/wp\/v2\/categories?post=330"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/freedville.com\/blog\/wp-json\/wp\/v2\/tags?post=330"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}