{"id":11578,"date":"2018-10-29T21:05:54","date_gmt":"2018-10-29T15:35:54","guid":{"rendered":"http:\/\/ucanalytics.com\/blogs\/?p=11578"},"modified":"2018-10-30T21:47:38","modified_gmt":"2018-10-30T16:17:38","slug":"deep-learning-models-simplified-part-3","status":"publish","type":"post","link":"https:\/\/ucanalytics.com\/blogs\/deep-learning-models-simplified-part-3\/","title":{"rendered":"Deep Learning Models Simplified (Part 3)"},"content":{"rendered":"<hr \/>\n<p>Facebook was a major sensation and a source of great amusement in a British\u00a0country house in the early 20th century. It was such a big hit that it got a special mention in a newspaper published in the year 1902. Facebook, then, of course, had a completely different meaning than the online social media we know.<\/p>\n<div id=\"attachment_11682\" style=\"width: 599px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Newspaper-Cutting.jpg\"><img aria-describedby=\"caption-attachment-11682\" data-attachment-id=\"11682\" data-permalink=\"https:\/\/ucanalytics.com\/blogs\/deep-learning-models-simplified-part-3\/newspaper-cutting\/\" data-orig-file=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Newspaper-Cutting.jpg?fit=615%2C409&amp;ssl=1\" data-orig-size=\"615,409\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Newspaper-Cutting\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Newspaper-Cutting.jpg?fit=300%2C200&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Newspaper-Cutting.jpg?fit=615%2C409&amp;ssl=1\" decoding=\"async\" loading=\"lazy\" class=\"wp-image-11682\" src=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Newspaper-Cutting.jpg?resize=589%2C392\" alt=\"\" width=\"589\" height=\"392\" srcset=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Newspaper-Cutting.jpg?w=615&amp;ssl=1 615w, https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Newspaper-Cutting.jpg?resize=250%2C166&amp;ssl=1 250w, https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Newspaper-Cutting.jpg?resize=300%2C200&amp;ssl=1 300w\" sizes=\"(max-width: 589px) 100vw, 589px\" data-recalc-dims=\"1\" \/><\/a><p id=\"caption-attachment-11682\" class=\"wp-caption-text\">The Western Times cutting from 1902 Source: www.irishmirror.ie<\/p><\/div>\n<p>A lot of human knowledge and amusing facts, like this newspaper cutting, still\u00a0exist in non-digital formats. The job of converting such documents to digital text format, like MS word doc, is performed by optical character recognition (OCR) tools. Notably, such machine-encoded-text is much easier to classify, search, modify, store, and analyze. An OCR conversion of the same cutting is displayed here.<a href=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Facebook-Deep-learning-OCR.jpg\"><img data-attachment-id=\"11610\" data-permalink=\"https:\/\/ucanalytics.com\/blogs\/deep-learning-models-simplified-part-3\/facebook-deep-learning-ocr\/\" data-orig-file=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Facebook-Deep-learning-OCR.jpg?fit=856%2C384&amp;ssl=1\" data-orig-size=\"856,384\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Facebook &#8211; Deep learning OCR\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Facebook-Deep-learning-OCR.jpg?fit=300%2C135&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Facebook-Deep-learning-OCR.jpg?fit=640%2C287&amp;ssl=1\" decoding=\"async\" loading=\"lazy\" class=\"wp-image-11610 aligncenter\" src=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Facebook-Deep-learning-OCR.jpg?resize=640%2C287\" alt=\"\" width=\"640\" height=\"287\" srcset=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Facebook-Deep-learning-OCR.jpg?w=856&amp;ssl=1 856w, https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Facebook-Deep-learning-OCR.jpg?resize=250%2C112&amp;ssl=1 250w, https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Facebook-Deep-learning-OCR.jpg?resize=300%2C135&amp;ssl=1 300w, https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Facebook-Deep-learning-OCR.jpg?resize=768%2C345&amp;ssl=1 768w\" sizes=\"(max-width: 640px) 100vw, 640px\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<p>Most OCR tools do a good job but they still make mistakes as we saw for our newspaper cutting. Here, nobody cares about &#8216;lenee-book&#8217; (as this OCR tool deciphered &#8216;Face-book&#8217;). This tool,\u00a0notably, got 49 out of 52 words correctly. This was not an easy\u00a0task even for our eye on this more than a century-old cutting. In terms of individual characters, we have got 98.3% accuracy here with just 5 mistakes out of 288 characters.<\/p>\n<p>OCR is also a source of excitement for data scientists since, using OCRs you could use non-digital data, such as application forms, electricity bills, receipts, etc.,\u00a0for your analysis.<\/p>\n<h2><span style=\"color: #3366ff;\">Deep Learning Models and OCR<\/span><\/h2>\n<p>Almost all OCR software tools in the market are\u00a0powered by deep learning models. In this article, we will learn how deep learning converts a newspaper cutting to a word document. This is similar to how your eyes see a book and convert the\u00a0ink marks into the familiar characters in your brain. Yes, we are entering the realm of artificial intelligence.<\/p>\n<p>In this and the subsequent article, you will build models, and learn how to improve the accuracy of an OCR using machine learning (ML) and deep learning models. You will build four models with these accuracies on the test data.<\/p>\n<ul>\n<li>Logistic regression (Model 1): 92% accuracy<\/li>\n<li>Random forest (Model 2): 96.8%\u00a0accuracy<\/li>\n<li>Deep learning neural networks (Model 3): 97.9%\u00a0accuracy<\/li>\n<li>Convolution neural networks (Model 4): 99.1%\u00a0accuracy<\/li>\n<\/ul>\n<p>Keep an eye for what is going behind the scenes for the error to reduce over 85% from logistic regression to CNN.\u00a0But before we start, let&#8217;s meet Popeye and see how he is similar to machine learning and deep learning models.<\/p>\n<div id=\"attachment_11579\" style=\"width: 970px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Popeye-Deep-Learning.jpg\"><img aria-describedby=\"caption-attachment-11579\" data-attachment-id=\"11579\" data-permalink=\"https:\/\/ucanalytics.com\/blogs\/deep-learning-models-simplified-part-3\/popeye-deep-learning\/\" data-orig-file=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Popeye-Deep-Learning.jpg?fit=960%2C686&amp;ssl=1\" data-orig-size=\"960,686\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1538644163&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;1&quot;}\" data-image-title=\"Popeye &#8211; Deep Learning\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Popeye-Deep-Learning.jpg?fit=300%2C214&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Popeye-Deep-Learning.jpg?fit=640%2C457&amp;ssl=1\" decoding=\"async\" loading=\"lazy\" class=\"wp-image-11579 size-full\" src=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Popeye-Deep-Learning.jpg?resize=640%2C457\" alt=\"\" width=\"640\" height=\"457\" srcset=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Popeye-Deep-Learning.jpg?w=960&amp;ssl=1 960w, https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Popeye-Deep-Learning.jpg?resize=250%2C179&amp;ssl=1 250w, https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Popeye-Deep-Learning.jpg?resize=300%2C214&amp;ssl=1 300w, https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Popeye-Deep-Learning.jpg?resize=768%2C549&amp;ssl=1 768w\" sizes=\"(max-width: 640px) 100vw, 640px\" data-recalc-dims=\"1\" \/><\/a><p id=\"caption-attachment-11579\" class=\"wp-caption-text\">Popeye and Deep Learning Models &#8211; by Roopam<\/p><\/div>\n<h2><span style=\"color: #3366ff;\">Data for Machine Learning &amp;\u00a0<\/span><span style=\"color: #3366ff;\">Deep Learning Models<\/span><\/h2>\n<p>Popeye the sailor&#8217;s love-interest Olive Oyl is kidnapped by his arch-rival Bluto. He is no match for Bluto&#8217;s strength but Popeye has to save Olive Oyl. Popeye gobbles down a can of spinach\u00a0and gains superhuman-strength to beat Bluto the brute. Our hero is triumphant again! Popeye gets all his strength from spinach and nothing else. If he eats potatoes or tomatoes or anything else he will continue to be inferior to Bluto. Machine learning or deep learning models are no different.<\/p>\n<p>Deep learning models are powered by the way they gobble data. The data have to be in a specific format (like spinach) for ML and DL models to\u00a0learn from them. Let&#8217;s try to understand\u00a0this using this picture. We see the number &#8216;2&#8217; in this 2-dimensional image or 2D pixelated data. ML and DL models can&#8217;t digest 2D or higher dimension data. They get their strength, like just spinach, from the 1D data (a vector) displayed in the image.<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Deep-Learning-Neural-Networks-Image-Transformation.jpg\"><img data-attachment-id=\"11630\" data-permalink=\"https:\/\/ucanalytics.com\/blogs\/deep-learning-models-simplified-part-3\/deep-learning-neural-networks-image-transformation\/\" data-orig-file=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Deep-Learning-Neural-Networks-Image-Transformation.jpg?fit=1331%2C763&amp;ssl=1\" data-orig-size=\"1331,763\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Deep Learning Neural Networks &#8211; Image Transformation\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Deep-Learning-Neural-Networks-Image-Transformation.jpg?fit=300%2C172&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Deep-Learning-Neural-Networks-Image-Transformation.jpg?fit=640%2C367&amp;ssl=1\" decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-11630\" src=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Deep-Learning-Neural-Networks-Image-Transformation.jpg?resize=640%2C367\" alt=\"\" width=\"640\" height=\"367\" srcset=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Deep-Learning-Neural-Networks-Image-Transformation.jpg?w=1331&amp;ssl=1 1331w, https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Deep-Learning-Neural-Networks-Image-Transformation.jpg?resize=250%2C143&amp;ssl=1 250w, https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Deep-Learning-Neural-Networks-Image-Transformation.jpg?resize=300%2C172&amp;ssl=1 300w, https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Deep-Learning-Neural-Networks-Image-Transformation.jpg?resize=768%2C440&amp;ssl=1 768w, https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Deep-Learning-Neural-Networks-Image-Transformation.jpg?resize=1024%2C587&amp;ssl=1 1024w, https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Deep-Learning-Neural-Networks-Image-Transformation.jpg?w=1280 1280w\" sizes=\"(max-width: 640px) 100vw, 640px\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<p>This is a black-and-white image hence has just 2-dimensions (2D). A color image with red-green-blue (RGB) components is a 3D data. A color video is 4-dimensional with an additional time dimension. This higher dimension data is transformed to\u00a01D for ML algorithms to digest them. OK, so now that you are aware of this important requirement, you are ready to start your&#8230;<\/p>\n<h2><span style=\"color: #3366ff;\">Machine Learning and Deep Learning Models<\/span><\/h2>\n<p><a href=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Image-of-0-Deep-Learning-Modeling.jpg\"><img data-attachment-id=\"11678\" data-permalink=\"https:\/\/ucanalytics.com\/blogs\/deep-learning-models-simplified-part-3\/image-of-0-deep-learning-modeling\/\" data-orig-file=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Image-of-0-Deep-Learning-Modeling.jpg?fit=758%2C783&amp;ssl=1\" data-orig-size=\"758,783\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Image of 0 &#8211; Deep Learning Modeling\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Image-of-0-Deep-Learning-Modeling.jpg?fit=290%2C300&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Image-of-0-Deep-Learning-Modeling.jpg?fit=640%2C661&amp;ssl=1\" decoding=\"async\" loading=\"lazy\" class=\"wp-image-11678 alignright\" src=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Image-of-0-Deep-Learning-Modeling.jpg?resize=310%2C320\" alt=\"\" width=\"310\" height=\"320\" srcset=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Image-of-0-Deep-Learning-Modeling.jpg?w=758&amp;ssl=1 758w, https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Image-of-0-Deep-Learning-Modeling.jpg?resize=242%2C250&amp;ssl=1 242w, https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Image-of-0-Deep-Learning-Modeling.jpg?resize=290%2C300&amp;ssl=1 290w\" sizes=\"(max-width: 310px) 100vw, 310px\" data-recalc-dims=\"1\" \/><\/a>You can find the Python notebook with the entire code used in this article here:\u00a0<strong><a href=\"http:\/\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/YOU-CANalytics-Machine-Learning-Deep-Learning-Modeling.html\" rel=\"noopener\">YOU CANalytics &#8211; Machine Learning &amp; Deep Learning Models<\/a>.<\/strong>\u00a0The first thing to build an OCR is to get image data from an enormous number of newspaper articles (like we saw earlier). The next task is for humans to read these articles and convert them to a digital format on a Notepad application. Machines will then learn using both the original articles and the digital format. When machines have seen enough such data and learned from them, they will be able to read an unknown document and convert it to the digital format.<\/p>\n<p>The process is exactly the same for hand-written text as well. Someone has done this hard job of converting images of many hand-written digits, as shown below, to digital format (0,1,..,9).\u00a0 Here, you are seeing 50 different images from the same large image dataset of 70,000 images. These images and corresponding digits are part of a popular and freely available dataset called MNIST.<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/MNIST-Deep-Learning-Modeling.jpg\"><img data-attachment-id=\"11659\" data-permalink=\"https:\/\/ucanalytics.com\/blogs\/deep-learning-models-simplified-part-3\/mnist-deep-learning-modeling\/\" data-orig-file=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/MNIST-Deep-Learning-Modeling.jpg?fit=604%2C311&amp;ssl=1\" data-orig-size=\"604,311\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"MNIST &#8211; Deep Learning Modeling\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/MNIST-Deep-Learning-Modeling.jpg?fit=300%2C154&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/MNIST-Deep-Learning-Modeling.jpg?fit=604%2C311&amp;ssl=1\" decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-11659\" src=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/MNIST-Deep-Learning-Modeling.jpg?resize=604%2C311\" alt=\"\" width=\"604\" height=\"311\" srcset=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/MNIST-Deep-Learning-Modeling.jpg?w=604&amp;ssl=1 604w, https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/MNIST-Deep-Learning-Modeling.jpg?resize=250%2C129&amp;ssl=1 250w, https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/MNIST-Deep-Learning-Modeling.jpg?resize=300%2C154&amp;ssl=1 300w\" sizes=\"(max-width: 604px) 100vw, 604px\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<p>These are all 28&#215;28 pixel images.\u00a0Now, the machine learning algorithm knows that the first five images are of the digit &#8216;0&#8217; and the next five are &#8216;1&#8217;s and so on. We will make the algorithm learn or train using any 60,000 of these 70,000 images. The remaining 10,000 images will then be the test set or unknown images for the algorithm. If the algorithm does a good job on the unknown test set then we have our first OCR application for hand-written numbers or digits.<\/p>\n<h2><span style=\"color: #3366ff;\">Data Preparation for Machine Learning &amp; Deep Learning Models<\/span><\/h2>\n<p>An image is nothing but a matrix of numbers as displayed here. Here, 255 displays the most intense shade (black here) and 0 displays absence of that shade (i.e white in this case). Similarly, greys will be some numbers between these extremes.<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Deep-learning-modeling-Image-Matrix-Data.jpg\"><img data-attachment-id=\"11700\" data-permalink=\"https:\/\/ucanalytics.com\/blogs\/deep-learning-models-simplified-part-3\/deep-learning-modeling-image-matrix-data\/\" data-orig-file=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Deep-learning-modeling-Image-Matrix-Data.jpg?fit=1234%2C834&amp;ssl=1\" data-orig-size=\"1234,834\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Deep learning modeling &#8211; Image Matrix &#038; Data\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Deep-learning-modeling-Image-Matrix-Data.jpg?fit=300%2C203&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Deep-learning-modeling-Image-Matrix-Data.jpg?fit=640%2C433&amp;ssl=1\" decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-11700 aligncenter\" src=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Deep-learning-modeling-Image-Matrix-Data.jpg?resize=640%2C433\" alt=\"\" width=\"640\" height=\"433\" srcset=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Deep-learning-modeling-Image-Matrix-Data.jpg?w=1234&amp;ssl=1 1234w, https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Deep-learning-modeling-Image-Matrix-Data.jpg?resize=250%2C169&amp;ssl=1 250w, https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Deep-learning-modeling-Image-Matrix-Data.jpg?resize=300%2C203&amp;ssl=1 300w, https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Deep-learning-modeling-Image-Matrix-Data.jpg?resize=768%2C519&amp;ssl=1 768w, https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Deep-learning-modeling-Image-Matrix-Data.jpg?resize=1024%2C692&amp;ssl=1 1024w\" sizes=\"(max-width: 640px) 100vw, 640px\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<p>Now, we can easily transform this matrix to flatten it to a single row with X1 to X15 as predictor variables and Y as the target. Y is tagged by humans after looking at the image. We will have 60,000 such rows with 28&#215;28 = 784 predictor variables for our data. Now let&#8217;s use this data to build our first logistic regression model.<\/p>\n<h2><span style=\"color: #3366ff;\">Model 1: Logistic Regression<\/span><\/h2>\n<p>We have discussed <strong><a href=\"http:\/\/ucanalytics.com\/blogs\/?s=logistic+regression\" rel=\"noopener\">logistic regression<\/a><\/strong> in great detail in YOU CANalytics earlier. Check out those articles. In this case, since the target variable has 10 categories (digits: 0,1,..,9), we will build 10 different logistic regression models to predict the probability of an image being any of these 10 digits. A single logistic regression model predicts the probability of one digit against the remaining nine digits.<\/p>\n<p>Here, you can see the output of the logistic regression model for one of the test images.<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Logistic-Regression-Probabilities-for-the-Image.jpg\"><img data-attachment-id=\"11708\" data-permalink=\"https:\/\/ucanalytics.com\/blogs\/deep-learning-models-simplified-part-3\/logistic-regression-probabilities-for-the-image\/\" data-orig-file=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Logistic-Regression-Probabilities-for-the-Image.jpg?fit=1674%2C874&amp;ssl=1\" data-orig-size=\"1674,874\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Logistic Regression Probabilities for the Image\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Logistic-Regression-Probabilities-for-the-Image.jpg?fit=300%2C157&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Logistic-Regression-Probabilities-for-the-Image.jpg?fit=640%2C334&amp;ssl=1\" decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-11708\" src=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Logistic-Regression-Probabilities-for-the-Image.jpg?resize=640%2C334\" alt=\"\" width=\"640\" height=\"334\" srcset=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Logistic-Regression-Probabilities-for-the-Image.jpg?w=1674&amp;ssl=1 1674w, https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Logistic-Regression-Probabilities-for-the-Image.jpg?resize=250%2C131&amp;ssl=1 250w, https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Logistic-Regression-Probabilities-for-the-Image.jpg?resize=300%2C157&amp;ssl=1 300w, https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Logistic-Regression-Probabilities-for-the-Image.jpg?resize=768%2C401&amp;ssl=1 768w, https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Logistic-Regression-Probabilities-for-the-Image.jpg?resize=1024%2C535&amp;ssl=1 1024w, https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Logistic-Regression-Probabilities-for-the-Image.jpg?w=1280 1280w\" sizes=\"(max-width: 640px) 100vw, 640px\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<p>Logistic regression predicts 97.8% probability of this image being &#8216;0&#8217;. The models did a good job for this image.\u00a0 However, the logistic regression models made mistakes for close to 800 test-images out of 10,000 with 92% accuracy. Here you see one such image with the wrong output. (image # 38 in the test set.)<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Logistic-Regression-Probabilities-for-the-Image-Wrong.jpg\"><img data-attachment-id=\"11714\" data-permalink=\"https:\/\/ucanalytics.com\/blogs\/deep-learning-models-simplified-part-3\/logistic-regression-probabilities-for-the-image-wrong\/\" data-orig-file=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Logistic-Regression-Probabilities-for-the-Image-Wrong.jpg?fit=1670%2C876&amp;ssl=1\" data-orig-size=\"1670,876\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Logistic Regression Probabilities for the Image &#8211; Wrong\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Logistic-Regression-Probabilities-for-the-Image-Wrong.jpg?fit=300%2C157&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Logistic-Regression-Probabilities-for-the-Image-Wrong.jpg?fit=640%2C336&amp;ssl=1\" decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-11714\" src=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Logistic-Regression-Probabilities-for-the-Image-Wrong.jpg?resize=640%2C336\" alt=\"\" width=\"640\" height=\"336\" srcset=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Logistic-Regression-Probabilities-for-the-Image-Wrong.jpg?w=1670&amp;ssl=1 1670w, https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Logistic-Regression-Probabilities-for-the-Image-Wrong.jpg?resize=250%2C131&amp;ssl=1 250w, https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Logistic-Regression-Probabilities-for-the-Image-Wrong.jpg?resize=300%2C157&amp;ssl=1 300w, https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Logistic-Regression-Probabilities-for-the-Image-Wrong.jpg?resize=768%2C403&amp;ssl=1 768w, https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Logistic-Regression-Probabilities-for-the-Image-Wrong.jpg?resize=1024%2C537&amp;ssl=1 1024w, https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Logistic-Regression-Probabilities-for-the-Image-Wrong.jpg?w=1280 1280w\" sizes=\"(max-width: 640px) 100vw, 640px\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<p>Here, logistic regression is classifying this image as either 2, 3, or 8 with the same probability (33%). We can all easily see that this is &#8216;2&#8217;. You may also want to see other places where the model has made mistakes. This will be an interesting and enlightening exercise for you. Use this Python script to identify places where the model and humans don&#8217;t agree.<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\"> \r\nimport numpy as np\r\nimport matplotlib.pyplot as plt\r\nnp.where((Number_test!=Number_pred_LR))\r\n# Change the number in paranthesis [38] to other numbers with mismatches\r\nplt.imshow(Image_test[38].reshape(28,28), cmap = matplotlib.cm.binary)\r\nclassifier.predict_proba(Image_test[38].reshape(1,-1))<\/pre>\n<p>The next model we will build using random forest classifiers will correct some of these mistakes.<\/p>\n<h2><span style=\"color: #3366ff;\">Model 2 &#8211; Random Forest Model<\/span><\/h2>\n<p><img data-attachment-id=\"11667\" data-permalink=\"https:\/\/ucanalytics.com\/blogs\/deep-learning-models-simplified-part-3\/random-forest-feature-importance-mnist-digits\/\" data-orig-file=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Random-Forest-Feature-Importance-MNIST-Digits.jpg?fit=922%2C947&amp;ssl=1\" data-orig-size=\"922,947\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Random Forest &#8211; Feature Importance (MNIST Digits)\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Random-Forest-Feature-Importance-MNIST-Digits.jpg?fit=292%2C300&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Random-Forest-Feature-Importance-MNIST-Digits.jpg?fit=640%2C657&amp;ssl=1\" decoding=\"async\" loading=\"lazy\" class=\"wp-image-11667 alignright\" src=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Random-Forest-Feature-Importance-MNIST-Digits.jpg?resize=303%2C311\" alt=\"\" width=\"303\" height=\"311\" srcset=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Random-Forest-Feature-Importance-MNIST-Digits.jpg?w=922&amp;ssl=1 922w, https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Random-Forest-Feature-Importance-MNIST-Digits.jpg?resize=243%2C250&amp;ssl=1 243w, https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Random-Forest-Feature-Importance-MNIST-Digits.jpg?resize=292%2C300&amp;ssl=1 292w, https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Random-Forest-Feature-Importance-MNIST-Digits.jpg?resize=768%2C789&amp;ssl=1 768w\" sizes=\"(max-width: 303px) 100vw, 303px\" data-recalc-dims=\"1\" \/><\/p>\n<p>Random forest is a class of machine learning models that builds several decision trees from the same data. Decision trees, for a random forest, are built on randomly selected data from the training data. Notably, this makes the random forest equivalent to a democratic political system where every decision tree has a vote and voice. Read these articles to learn more about decision trees:<\/p>\n<ul>\n<li><a href=\"http:\/\/ucanalytics.com\/blogs\/decision-tree-cart-retail-case-example-part-5\/\" rel=\"noopener\"><strong>CART &#8211; classification and regression trees<\/strong><\/a><\/li>\n<li><a href=\"http:\/\/ucanalytics.com\/blogs\/decision-tree-entropy-retail-case-part-6\/\" rel=\"noopener\"><strong>Entropy-based decision trees<\/strong><\/a><\/li>\n<\/ul>\n<p>Random forest is also a relatively transparent model which explicitly highlights the important features or input variables. This enables us to ask questions such as, where do your eyes focus when they look at the MNIST images to decipher the digits hidden in them? Incidentally, the random forest model gives a good approximation for the same in this feature importance heat map. As expected, your eyes largely ignore the white spaces in the images and so does the random forest model (shown as cold &#8216;dark blue&#8217; in the heat map). The areas or pixels that are lit-up i.e yellow, green and light blue, are the areas of important features or places where your eyes focus.\u00a0Random forest model improved the test set accuracy to close to 97%. This model has also correctly classified the image of &#8216;2&#8217; mistaken by the logistic regression models.<\/p>\n<p>Around 97% seemed like the limit for the test set accuracy for this MNIST dataset before deep learning and neural networks came to the\u00a0rescue. Notably, an elaborated and well-tuned deep learning model can improve the accuracy to ~99.5%. This is a whopping\u00a083% reduction in the error over the other popular machine learning models. Let&#8217;s enter the territories of deep learning models with&#8230;<\/p>\n<h2><span style=\"color: #3366ff;\">Model 3 &#8211; Deep Learning Neural Networks<\/span><\/h2>\n<p>Recall, we solved this neural network in the last part to understand the\u00a0<strong><a href=\"http:\/\/ucanalytics.com\/blogs\/math-of-deep-learning-neural-networks-simplified-part-2\/\" target=\"_blank\" rel=\"noopener\">math of deep learning<\/a>.\u00a0<\/strong>In this network, we had nine parameters to solve i.e. six weights (W<sub>1<\/sub>, W<sub>2<\/sub>,.., W<sub>6<\/sub>) and three bias terms (b<sub>1<\/sub>, b<sub>2<\/sub>, and b<sub>3<\/sub>).<a href=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/09\/Maths-of-Deep-Learning-Neural-Networks-Image-3.jpg\"><img data-attachment-id=\"11320\" data-permalink=\"https:\/\/ucanalytics.com\/blogs\/math-of-deep-learning-neural-networks-simplified-part-2\/maths-of-deep-learning-neural-networks-image-3\/\" data-orig-file=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/09\/Maths-of-Deep-Learning-Neural-Networks-Image-3.jpg?fit=1470%2C840&amp;ssl=1\" data-orig-size=\"1470,840\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Maths of Deep Learning Neural Networks (Image 3)\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/09\/Maths-of-Deep-Learning-Neural-Networks-Image-3.jpg?fit=300%2C171&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/09\/Maths-of-Deep-Learning-Neural-Networks-Image-3.jpg?fit=640%2C366&amp;ssl=1\" decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-11320\" src=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/09\/Maths-of-Deep-Learning-Neural-Networks-Image-3.jpg?resize=640%2C366\" alt=\"\" width=\"640\" height=\"366\" srcset=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/09\/Maths-of-Deep-Learning-Neural-Networks-Image-3.jpg?w=1470&amp;ssl=1 1470w, https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/09\/Maths-of-Deep-Learning-Neural-Networks-Image-3.jpg?resize=250%2C143&amp;ssl=1 250w, https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/09\/Maths-of-Deep-Learning-Neural-Networks-Image-3.jpg?resize=300%2C171&amp;ssl=1 300w, https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/09\/Maths-of-Deep-Learning-Neural-Networks-Image-3.jpg?resize=768%2C439&amp;ssl=1 768w, https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/09\/Maths-of-Deep-Learning-Neural-Networks-Image-3.jpg?resize=1024%2C585&amp;ssl=1 1024w, https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/09\/Maths-of-Deep-Learning-Neural-Networks-Image-3.jpg?w=1280 1280w\" sizes=\"(max-width: 640px) 100vw, 640px\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<p>The network we will use for the images of hand-written digits is displayed below. This much more complicated network will require us to solve for 669,706 parameters. This network, first of all, has 784 input variables from 28\u00d728 pixel images. This network has 2 hidden layers with 512 nodes per hidden layers. Finally, there are 10 possible outputs (0,1,..,9). These outputs are then converted to probabilities using the softmax function in the last layer.<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/MNIST-Deep-earning-Neural-Network-Architecture.jpg\"><img data-attachment-id=\"11746\" data-permalink=\"https:\/\/ucanalytics.com\/blogs\/?attachment_id=11746\" data-orig-file=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/MNIST-Deep-earning-Neural-Network-Architecture.jpg?fit=1839%2C1016&amp;ssl=1\" data-orig-size=\"1839,1016\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"MNIST Deep earning Neural Network Architecture\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/MNIST-Deep-earning-Neural-Network-Architecture.jpg?fit=300%2C166&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/MNIST-Deep-earning-Neural-Network-Architecture.jpg?fit=640%2C354&amp;ssl=1\" decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-11746 aligncenter\" src=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/MNIST-Deep-earning-Neural-Network-Architecture.jpg?resize=640%2C354\" alt=\"\" width=\"640\" height=\"354\" srcset=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/MNIST-Deep-earning-Neural-Network-Architecture.jpg?w=1839&amp;ssl=1 1839w, https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/MNIST-Deep-earning-Neural-Network-Architecture.jpg?resize=250%2C138&amp;ssl=1 250w, https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/MNIST-Deep-earning-Neural-Network-Architecture.jpg?resize=300%2C166&amp;ssl=1 300w, https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/MNIST-Deep-earning-Neural-Network-Architecture.jpg?resize=768%2C424&amp;ssl=1 768w, https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/MNIST-Deep-earning-Neural-Network-Architecture.jpg?resize=1024%2C566&amp;ssl=1 1024w, https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/MNIST-Deep-earning-Neural-Network-Architecture.jpg?w=1280 1280w\" sizes=\"(max-width: 640px) 100vw, 640px\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<p>Let&#8217;s do a quick calculation to understand where these\u00a0669,706 parameters are coming from. There are 784 input nodes connected to 512 nodes in the first hidden layer. Additionally, the first bias term is connected to the same 512 nodes in the first hidden layer. This makes the total connections (or parameters to calculate) between the input layer and first hidden layers equal to:<\/p>\n<pre>784 \u00d7 512 + 512 = 401,408 + 512 = 401,920<\/pre>\n<p>Similarly, the first and the second hidden layers are connected by<\/p>\n<pre>512 \u00d7 512 + 512 =\u00a0262,656<\/pre>\n<p>Finally, 10 output nodes are connected to 512 nodes the in the second hidden layer and one bias node.<\/p>\n<pre>512 \u00d7 10 + 10 = 5130<\/pre>\n<p>You will get the same information from the summary function of the network in Python \/ Keras, as displayed here.<\/p>\n<div class=\"p-Widget p-Panel jp-Cell-inputWrapper\">\n<div class=\"p-Widget jp-InputArea jp-Cell-inputArea\">\n<div class=\"p-Widget jp-CodeMirrorEditor jp-Editor jp-InputArea-editor jp-mod-focused\" data-type=\"inline\">\n<div class=\"CodeMirror cm-s-jupyter CodeMirror-wrap CodeMirror-focused jp-mod-readOnly\">\n<div class=\"CodeMirror-scroll\" tabindex=\"-1\" draggable=\"true\">\n<div class=\"CodeMirror-sizer\">\n<div class=\"CodeMirror-lines\" role=\"presentation\">\n<div role=\"presentation\">\n<div class=\"CodeMirror-code\" role=\"presentation\">\n<div class=\"p-Widget p-Panel jp-Cell-inputWrapper\">\n<div class=\"p-Widget jp-InputArea jp-Cell-inputArea\">\n<div class=\"p-Widget jp-CodeMirrorEditor jp-Editor jp-InputArea-editor jp-mod-has-primary-selection\" data-type=\"inline\">\n<div class=\"CodeMirror cm-s-jupyter CodeMirror-wrap jp-mod-readOnly\">\n<div class=\"CodeMirror-scroll\" tabindex=\"-1\" draggable=\"true\">\n<div class=\"CodeMirror-sizer\">\n<div>\n<div class=\"CodeMirror-lines\" role=\"presentation\">\n<div role=\"presentation\">\n<div class=\"CodeMirror-code\" role=\"presentation\">\n<pre class=\"brush: python; title: ; notranslate\" title=\"\"> nn_mnist.summary() <\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"p-Widget p-Panel jp-Cell-outputWrapper\">\n<div class=\"p-Widget jp-OutputArea jp-Cell-outputArea\">\n<div class=\"p-Widget p-Panel jp-OutputArea-child\">\n<div class=\"p-Widget jp-RenderedText jp-mod-trusted jp-OutputArea-output\" data-mime-type=\"application\/vnd.jupyter.stdout\">\n<pre>_________________________________________________________________\r\nLayer (type)                 Output Shape              Param #   \r\n=================================================================\r\ndense_1 (Dense)              (None, 512)               401920    \r\n_________________________________________________________________\r\ndense_2 (Dense)              (None, 512)               262656    \r\n_________________________________________________________________\r\ndense_3 (Dense)              (None, 10)                5130      \r\n=================================================================\r\nTotal params: 669,706\r\nTrainable params: 669,706\r\nNon-trainable params: 0\r\n_________________________________________________________________\r\n<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p>These 669706 parameters must have given you a good idea why deep learning models are called &#8216;black box&#8217; models. With this complicated network, it is absolutely impossible to understand the individual contribution of the 784 input variables to classify the images into digits.<\/p>\n<h2><span style=\"color: #3366ff;\">Deep Learning Model &amp; Results<\/span><\/h2>\n<p>Luckily for us, Tensorflow can easily calculate these weights using the same math we learned in the last part. This deep learning model gives the accuracy of ~98% on the test dataset. This confusion matrix shows that most of the times the deep learning model is right i.e. at the diagonal values.<a href=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Deep-learning-model-Confusion-Matrix.jpg\"><img data-attachment-id=\"11757\" data-permalink=\"https:\/\/ucanalytics.com\/blogs\/deep-learning-models-simplified-part-3\/deep-learning-model-confusion-matrix\/\" data-orig-file=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Deep-learning-model-Confusion-Matrix.jpg?fit=1111%2C1079&amp;ssl=1\" data-orig-size=\"1111,1079\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Deep learning model &#8211; Confusion Matrix\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Deep-learning-model-Confusion-Matrix.jpg?fit=300%2C291&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Deep-learning-model-Confusion-Matrix.jpg?fit=640%2C622&amp;ssl=1\" decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-11757\" src=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Deep-learning-model-Confusion-Matrix.jpg?resize=640%2C622\" alt=\"\" width=\"640\" height=\"622\" srcset=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Deep-learning-model-Confusion-Matrix.jpg?w=1111&amp;ssl=1 1111w, https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Deep-learning-model-Confusion-Matrix.jpg?resize=250%2C243&amp;ssl=1 250w, https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Deep-learning-model-Confusion-Matrix.jpg?resize=300%2C291&amp;ssl=1 300w, https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Deep-learning-model-Confusion-Matrix.jpg?resize=768%2C746&amp;ssl=1 768w, https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Deep-learning-model-Confusion-Matrix.jpg?resize=1024%2C995&amp;ssl=1 1024w\" sizes=\"(max-width: 640px) 100vw, 640px\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<p>Let&#8217;s see where this model has made mistakes by considering more than 10 mistakes of similar kinds. The model has, on occasions, confused 9 with 3, 4 and 7. Also, it identifies 8 as 3 or 7. Moreover, 5 is also confused with 3 on a few instances.<\/p>\n<h4><span style=\"color: #3366ff;\">Sign-off Note<\/span><\/h4>\n<p>Popeye gets his energy from spinach but spinach can be of different qualities as well. A good quality spinach can give higher strength or at least prevent food poisoning or a bad stomach. Similarly, there are ways to improve the quality of input data for deep learning models as well. We will learn the same in the next part when we will explore convolutional neural networks to improve the accuracy further.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Facebook was a major sensation and a source of great amusement in a British\u00a0country house in the early 20th century. It was such a big hit that it got a special mention in a newspaper published in the year 1902. Facebook, then, of course, had a completely different meaning than the online social media we<\/p>\n<p><a class=\"excerpt-more blog-excerpt\" href=\"https:\/\/ucanalytics.com\/blogs\/deep-learning-models-simplified-part-3\/\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":1,"featured_media":11579,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_newsletter_tier_id":0,"jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[86],"tags":[],"jetpack_publicize_connections":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v17.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Deep Learning Models Simplified (Part 3) &ndash; YOU CANalytics |<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/ucanalytics.com\/blogs\/deep-learning-models-simplified-part-3\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Deep Learning Models Simplified (Part 3) &ndash; YOU CANalytics |\" \/>\n<meta property=\"og:description\" content=\"Facebook was a major sensation and a source of great amusement in a British\u00a0country house in the early 20th century. It was such a big hit that it got a special mention in a newspaper published in the year 1902. Facebook, then, of course, had a completely different meaning than the online social media weRead More...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/ucanalytics.com\/blogs\/deep-learning-models-simplified-part-3\/\" \/>\n<meta property=\"og:site_name\" content=\"YOU CANalytics |\" \/>\n<meta property=\"article:author\" content=\"roopam\" \/>\n<meta property=\"article:published_time\" content=\"2018-10-29T15:35:54+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-10-30T16:17:38+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Popeye-Deep-Learning.jpg?fit=960%2C686&#038;ssl=1\" \/>\n\t<meta property=\"og:image:width\" content=\"960\" \/>\n\t<meta property=\"og:image:height\" content=\"686\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Roopam Upadhyay\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"10 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https:\/\/ucanalytics.com\/blogs\/#organization\",\"name\":\"YOU CANalytics\",\"url\":\"https:\/\/ucanalytics.com\/blogs\/\",\"sameAs\":[],\"logo\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/ucanalytics.com\/blogs\/#logo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2015\/11\/YOU-CANalytics-Logo.jpg?fit=607%2C120\",\"contentUrl\":\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2015\/11\/YOU-CANalytics-Logo.jpg?fit=607%2C120\",\"width\":607,\"height\":120,\"caption\":\"YOU CANalytics\"},\"image\":{\"@id\":\"https:\/\/ucanalytics.com\/blogs\/#logo\"}},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/ucanalytics.com\/blogs\/#website\",\"url\":\"https:\/\/ucanalytics.com\/blogs\/\",\"name\":\"YOU CANalytics |\",\"description\":\"Explore the Power of Data Science\",\"publisher\":{\"@id\":\"https:\/\/ucanalytics.com\/blogs\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/ucanalytics.com\/blogs\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/ucanalytics.com\/blogs\/deep-learning-models-simplified-part-3\/#primaryimage\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Popeye-Deep-Learning.jpg?fit=960%2C686&ssl=1\",\"contentUrl\":\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Popeye-Deep-Learning.jpg?fit=960%2C686&ssl=1\",\"width\":960,\"height\":686},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/ucanalytics.com\/blogs\/deep-learning-models-simplified-part-3\/#webpage\",\"url\":\"https:\/\/ucanalytics.com\/blogs\/deep-learning-models-simplified-part-3\/\",\"name\":\"Deep Learning Models Simplified (Part 3) &ndash; YOU CANalytics |\",\"isPartOf\":{\"@id\":\"https:\/\/ucanalytics.com\/blogs\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/ucanalytics.com\/blogs\/deep-learning-models-simplified-part-3\/#primaryimage\"},\"datePublished\":\"2018-10-29T15:35:54+00:00\",\"dateModified\":\"2018-10-30T16:17:38+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/ucanalytics.com\/blogs\/deep-learning-models-simplified-part-3\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/ucanalytics.com\/blogs\/deep-learning-models-simplified-part-3\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/ucanalytics.com\/blogs\/deep-learning-models-simplified-part-3\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/ucanalytics.com\/blogs\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Deep Learning Models Simplified (Part 3)\"}]},{\"@type\":\"Article\",\"@id\":\"https:\/\/ucanalytics.com\/blogs\/deep-learning-models-simplified-part-3\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/ucanalytics.com\/blogs\/deep-learning-models-simplified-part-3\/#webpage\"},\"author\":{\"@id\":\"https:\/\/ucanalytics.com\/blogs\/#\/schema\/person\/55961a1cea272ecdf290cb387be069b6\"},\"headline\":\"Deep Learning Models Simplified (Part 3)\",\"datePublished\":\"2018-10-29T15:35:54+00:00\",\"dateModified\":\"2018-10-30T16:17:38+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/ucanalytics.com\/blogs\/deep-learning-models-simplified-part-3\/#webpage\"},\"wordCount\":1997,\"commentCount\":4,\"publisher\":{\"@id\":\"https:\/\/ucanalytics.com\/blogs\/#organization\"},\"image\":{\"@id\":\"https:\/\/ucanalytics.com\/blogs\/deep-learning-models-simplified-part-3\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Popeye-Deep-Learning.jpg?fit=960%2C686&ssl=1\",\"articleSection\":[\"Deep Learning Neural Networks\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/ucanalytics.com\/blogs\/deep-learning-models-simplified-part-3\/#respond\"]}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/ucanalytics.com\/blogs\/#\/schema\/person\/55961a1cea272ecdf290cb387be069b6\",\"name\":\"Roopam Upadhyay\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/ucanalytics.com\/blogs\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/dd1aa0b0e813f7639800bcfad6a554f1?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/dd1aa0b0e813f7639800bcfad6a554f1?s=96&d=mm&r=g\",\"caption\":\"Roopam Upadhyay\"},\"description\":\"This blog contains my personal views and thoughts on predictive Analytics and big data. - Roopam Upadhyay\",\"sameAs\":[\"roopam\"],\"url\":\"https:\/\/ucanalytics.com\/blogs\/author\/roopam\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Deep Learning Models Simplified (Part 3) &ndash; YOU CANalytics |","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/ucanalytics.com\/blogs\/deep-learning-models-simplified-part-3\/","og_locale":"en_US","og_type":"article","og_title":"Deep Learning Models Simplified (Part 3) &ndash; YOU CANalytics |","og_description":"Facebook was a major sensation and a source of great amusement in a British\u00a0country house in the early 20th century. It was such a big hit that it got a special mention in a newspaper published in the year 1902. Facebook, then, of course, had a completely different meaning than the online social media weRead More...","og_url":"https:\/\/ucanalytics.com\/blogs\/deep-learning-models-simplified-part-3\/","og_site_name":"YOU CANalytics |","article_author":"roopam","article_published_time":"2018-10-29T15:35:54+00:00","article_modified_time":"2018-10-30T16:17:38+00:00","og_image":[{"width":960,"height":686,"url":"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Popeye-Deep-Learning.jpg?fit=960%2C686&ssl=1","type":"image\/jpeg"}],"twitter_misc":{"Written by":"Roopam Upadhyay","Est. reading time":"10 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Organization","@id":"https:\/\/ucanalytics.com\/blogs\/#organization","name":"YOU CANalytics","url":"https:\/\/ucanalytics.com\/blogs\/","sameAs":[],"logo":{"@type":"ImageObject","@id":"https:\/\/ucanalytics.com\/blogs\/#logo","inLanguage":"en-US","url":"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2015\/11\/YOU-CANalytics-Logo.jpg?fit=607%2C120","contentUrl":"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2015\/11\/YOU-CANalytics-Logo.jpg?fit=607%2C120","width":607,"height":120,"caption":"YOU CANalytics"},"image":{"@id":"https:\/\/ucanalytics.com\/blogs\/#logo"}},{"@type":"WebSite","@id":"https:\/\/ucanalytics.com\/blogs\/#website","url":"https:\/\/ucanalytics.com\/blogs\/","name":"YOU CANalytics |","description":"Explore the Power of Data Science","publisher":{"@id":"https:\/\/ucanalytics.com\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/ucanalytics.com\/blogs\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"ImageObject","@id":"https:\/\/ucanalytics.com\/blogs\/deep-learning-models-simplified-part-3\/#primaryimage","inLanguage":"en-US","url":"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Popeye-Deep-Learning.jpg?fit=960%2C686&ssl=1","contentUrl":"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Popeye-Deep-Learning.jpg?fit=960%2C686&ssl=1","width":960,"height":686},{"@type":"WebPage","@id":"https:\/\/ucanalytics.com\/blogs\/deep-learning-models-simplified-part-3\/#webpage","url":"https:\/\/ucanalytics.com\/blogs\/deep-learning-models-simplified-part-3\/","name":"Deep Learning Models Simplified (Part 3) &ndash; YOU CANalytics |","isPartOf":{"@id":"https:\/\/ucanalytics.com\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/ucanalytics.com\/blogs\/deep-learning-models-simplified-part-3\/#primaryimage"},"datePublished":"2018-10-29T15:35:54+00:00","dateModified":"2018-10-30T16:17:38+00:00","breadcrumb":{"@id":"https:\/\/ucanalytics.com\/blogs\/deep-learning-models-simplified-part-3\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/ucanalytics.com\/blogs\/deep-learning-models-simplified-part-3\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/ucanalytics.com\/blogs\/deep-learning-models-simplified-part-3\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/ucanalytics.com\/blogs\/"},{"@type":"ListItem","position":2,"name":"Deep Learning Models Simplified (Part 3)"}]},{"@type":"Article","@id":"https:\/\/ucanalytics.com\/blogs\/deep-learning-models-simplified-part-3\/#article","isPartOf":{"@id":"https:\/\/ucanalytics.com\/blogs\/deep-learning-models-simplified-part-3\/#webpage"},"author":{"@id":"https:\/\/ucanalytics.com\/blogs\/#\/schema\/person\/55961a1cea272ecdf290cb387be069b6"},"headline":"Deep Learning Models Simplified (Part 3)","datePublished":"2018-10-29T15:35:54+00:00","dateModified":"2018-10-30T16:17:38+00:00","mainEntityOfPage":{"@id":"https:\/\/ucanalytics.com\/blogs\/deep-learning-models-simplified-part-3\/#webpage"},"wordCount":1997,"commentCount":4,"publisher":{"@id":"https:\/\/ucanalytics.com\/blogs\/#organization"},"image":{"@id":"https:\/\/ucanalytics.com\/blogs\/deep-learning-models-simplified-part-3\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Popeye-Deep-Learning.jpg?fit=960%2C686&ssl=1","articleSection":["Deep Learning Neural Networks"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/ucanalytics.com\/blogs\/deep-learning-models-simplified-part-3\/#respond"]}]},{"@type":"Person","@id":"https:\/\/ucanalytics.com\/blogs\/#\/schema\/person\/55961a1cea272ecdf290cb387be069b6","name":"Roopam Upadhyay","image":{"@type":"ImageObject","@id":"https:\/\/ucanalytics.com\/blogs\/#personlogo","inLanguage":"en-US","url":"https:\/\/secure.gravatar.com\/avatar\/dd1aa0b0e813f7639800bcfad6a554f1?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/dd1aa0b0e813f7639800bcfad6a554f1?s=96&d=mm&r=g","caption":"Roopam Upadhyay"},"description":"This blog contains my personal views and thoughts on predictive Analytics and big data. - Roopam Upadhyay","sameAs":["roopam"],"url":"https:\/\/ucanalytics.com\/blogs\/author\/roopam\/"}]}},"jetpack_featured_media_url":"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Popeye-Deep-Learning.jpg?fit=960%2C686&ssl=1","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p3L0jT-30K","jetpack-related-posts":[{"id":11583,"url":"https:\/\/ucanalytics.com\/blogs\/convolutional-neural-networks-cnn-simplified-part-4\/","url_meta":{"origin":11578,"position":0},"title":"Convolutional Neural Networks (CNN) Simplified (Part 4)","author":"Roopam Upadhyay","date":false,"format":false,"excerpt":"Welcome back to the deep learning example to build an OCR application. The idea of this simple application is to identify numbers in an image of written text. In the last part, we used three different models and got the following accuracy for identification of the test images: Model 1\u2026","rel":"","context":"In &quot;Deep Learning Neural Networks&quot;","block_context":{"text":"Deep Learning Neural Networks","link":"https:\/\/ucanalytics.com\/blogs\/category\/deep-learning-neural-networks\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Convolutional-Neural-Networks-CNN-Filters-Polaroid-Glasses-by-Roopam.jpg?fit=775%2C581&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Convolutional-Neural-Networks-CNN-Filters-Polaroid-Glasses-by-Roopam.jpg?fit=775%2C581&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Convolutional-Neural-Networks-CNN-Filters-Polaroid-Glasses-by-Roopam.jpg?fit=775%2C581&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/10\/Convolutional-Neural-Networks-CNN-Filters-Polaroid-Glasses-by-Roopam.jpg?fit=775%2C581&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":11156,"url":"https:\/\/ucanalytics.com\/blogs\/deep-learning-and-neural-networks-simplified-part-1\/","url_meta":{"origin":11578,"position":1},"title":"Deep Learning and Neural Networks \u2013 Simplified (Part 1)","author":"Roopam Upadhyay","date":false,"format":false,"excerpt":"The entire field of artificial intelligence, in the last few years, is built upon deep learning or deep neural networks. Notably, Apple's Siri, Google-DeepMinds' AlphaGo, or the self-driving mechanism in Tesla cars are all based on deep learning. Here, my goal is to make deep learning neural networks\u00a0much more accessible\u2026","rel":"","context":"In &quot;Deep Learning Neural Networks&quot;","block_context":{"text":"Deep Learning Neural Networks","link":"https:\/\/ucanalytics.com\/blogs\/category\/deep-learning-neural-networks\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/08\/Deep-Learning-Neural-Networks-Front.jpg?fit=960%2C592&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/08\/Deep-Learning-Neural-Networks-Front.jpg?fit=960%2C592&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/08\/Deep-Learning-Neural-Networks-Front.jpg?fit=960%2C592&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/08\/Deep-Learning-Neural-Networks-Front.jpg?fit=960%2C592&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":9797,"url":"https:\/\/ucanalytics.com\/blogs\/reinforcement-learning-and-artificial-intelligence-digital-marketing-case-study-example-part-1\/","url_meta":{"origin":11578,"position":2},"title":"Reinforcement Learning and Artificial Intelligence &#8211; Digital Marketing Case Study Example (Part 1)","author":"Roopam Upadhyay","date":false,"format":false,"excerpt":"How to make machines learn on their own similar to humans? This is the pivotal question for the development of artificial intelligence. To develop intelligent machines and systems (artificial intelligence), we need to understand how human intelligence and learning work. For this, we will explore the ideas behind reinforcement learning.\u2026","rel":"","context":"In &quot;Digital Marketing - Case Study&quot;","block_context":{"text":"Digital Marketing - Case Study","link":"https:\/\/ucanalytics.com\/blogs\/category\/digital-marketing-case-study\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2017\/04\/Digital-Marketing-Campaign.jpg?fit=1200%2C654&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2017\/04\/Digital-Marketing-Campaign.jpg?fit=1200%2C654&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2017\/04\/Digital-Marketing-Campaign.jpg?fit=1200%2C654&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2017\/04\/Digital-Marketing-Campaign.jpg?fit=1200%2C654&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2017\/04\/Digital-Marketing-Campaign.jpg?fit=1200%2C654&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":6808,"url":"https:\/\/ucanalytics.com\/blogs\/learning-resources-artificial-intelligence-cognitive-computing-deep-learning-neural-networks\/","url_meta":{"origin":11578,"position":3},"title":"Learning Resources : Artificial Intelligence, Cognitive Computing, Deep Learning, &#038; Neural Networks","author":"Roopam Upadhyay","date":false,"format":false,"excerpt":"This article is an effort to make you into a \"semi-expert\" in artificial intelligence, cognitive computing, deep learning and neural networks from scratch. Here I will share a few cool learning resources for these topics. These resources include documentaries, TED talks, online lecture videos, and books. There are several videos\u2026","rel":"","context":"In &quot;Analytics Book Club&quot;","block_context":{"text":"Analytics Book Club","link":"https:\/\/ucanalytics.com\/blogs\/category\/analytics-book-club\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2015\/11\/Alice-in-Wonderland-Copy.jpg?fit=433%2C274&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":6402,"url":"https:\/\/ucanalytics.com\/blogs\/r-vs-python-comparison-and-awsome-books-free-pdfs-to-learn-them\/","url_meta":{"origin":11578,"position":4},"title":"R vs Python &#8211; a Comparison, and Awesome Free Books to Learn these Languages","author":"Roopam Upadhyay","date":false,"format":false,"excerpt":"Please read the disclaimer about the Free PDF Books in this article at the bottom The one thing they love more than a hero is to see a hero fail, fall, die trying. In spite of everything you've done for them, eventually, they will hate you [Spider-Man]. - Green Goblin\u2026","rel":"","context":"In &quot;Analytics Book Club&quot;","block_context":{"text":"Analytics Book Club","link":"https:\/\/ucanalytics.com\/blogs\/category\/analytics-book-club\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2015\/10\/Superman-V-Batman.jpg?fit=640%2C468&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2015\/10\/Superman-V-Batman.jpg?fit=640%2C468&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2015\/10\/Superman-V-Batman.jpg?fit=640%2C468&ssl=1&resize=525%2C300 1.5x"},"classes":[]},{"id":11290,"url":"https:\/\/ucanalytics.com\/blogs\/math-of-deep-learning-neural-networks-simplified-part-2\/","url_meta":{"origin":11578,"position":5},"title":"Math of Deep Learning Neural Networks &#8211; Simplified (Part 2)","author":"Roopam Upadhyay","date":false,"format":false,"excerpt":"Welcome back to this series of articles on deep learning and neural networks. In the last part, you learned how training a\u00a0deep learning network is similar to a plumbing job. This time you will learn the math of deep learning. We will continue to use the plumbing analogy to simplify\u2026","rel":"","context":"In &quot;Deep Learning Neural Networks&quot;","block_context":{"text":"Deep Learning Neural Networks","link":"https:\/\/ucanalytics.com\/blogs\/category\/deep-learning-neural-networks\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/08\/Deep-Learning-Neural-Networks-and-Plumbing-Job.jpg?fit=796%2C597&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/08\/Deep-Learning-Neural-Networks-and-Plumbing-Job.jpg?fit=796%2C597&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/08\/Deep-Learning-Neural-Networks-and-Plumbing-Job.jpg?fit=796%2C597&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/ucanalytics.com\/blogs\/wp-content\/uploads\/2018\/08\/Deep-Learning-Neural-Networks-and-Plumbing-Job.jpg?fit=796%2C597&ssl=1&resize=700%2C400 2x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/ucanalytics.com\/blogs\/wp-json\/wp\/v2\/posts\/11578"}],"collection":[{"href":"https:\/\/ucanalytics.com\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ucanalytics.com\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ucanalytics.com\/blogs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ucanalytics.com\/blogs\/wp-json\/wp\/v2\/comments?post=11578"}],"version-history":[{"count":0,"href":"https:\/\/ucanalytics.com\/blogs\/wp-json\/wp\/v2\/posts\/11578\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ucanalytics.com\/blogs\/wp-json\/wp\/v2\/media\/11579"}],"wp:attachment":[{"href":"https:\/\/ucanalytics.com\/blogs\/wp-json\/wp\/v2\/media?parent=11578"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ucanalytics.com\/blogs\/wp-json\/wp\/v2\/categories?post=11578"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ucanalytics.com\/blogs\/wp-json\/wp\/v2\/tags?post=11578"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}