<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Samuel Ogbonna on Medium]]></title>
        <description><![CDATA[Stories by Samuel Ogbonna on Medium]]></description>
        <link>https://medium.com/@samuelchimaogbonna?source=rss-8124a856b006------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*FG5evfJecDSnxVLoLhDOYw.jpeg</url>
            <title>Stories by Samuel Ogbonna on Medium</title>
            <link>https://medium.com/@samuelchimaogbonna?source=rss-8124a856b006------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 21:48:57 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@samuelchimaogbonna/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Is Your Machine Learning Model Worth the Stress?]]></title>
            <link>https://samuelchimaogbonna.medium.com/is-your-machine-learning-model-worth-the-stress-80aa93bfa808?source=rss-8124a856b006------2</link>
            <guid isPermaLink="false">https://medium.com/p/80aa93bfa808</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[python-programming]]></category>
            <dc:creator><![CDATA[Samuel Ogbonna]]></dc:creator>
            <pubDate>Fri, 26 Feb 2021 12:29:02 GMT</pubDate>
            <atom:updated>2021-02-27T09:02:20.039Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/626/1*5nwyBtCJNeCsr6HicHy-rA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/561/1*hJTFrFK1oICT9kqeoKQf3Q.png" /><figcaption>28x28 arrays used to store images in the MNIST dataset</figcaption></figure><p>Let’s say you’ve been asked to build a model that can differentiate between handwritten 3’s and 7’s using the MNIST dataset. You spend the next few weeks using machine learning to solve the problem and your final model makes predictions with 75% accuracy.</p><p>This sounds like a good number for a few weeks of work but how do we judge this performance? How do we really know if our super-fancy model is worth the time and manpower required for the Machine Learning process?</p><p>This is where baselines for machine learning projects come in. Baselines are simple models which we use to judge the performance of more complex models. If a simple model — built in a few hours— can achieve an accuracy of 70%, a machine learning model based on the same data and requiring a more sizeable investment of time, financial resources and computational resources should have a significantly improved performance.</p><p>A baseline is a simple, easy-to-implement model used to assess all later models — later models need to outperform the baseline. Another good method of getting a baseline is to search around to find other people who have solved problems like yours and run their code on your dataset.</p><p><strong>Creating a Baseline for a Sample Project</strong></p><p>To better understand the concept of baselines, we’ll apply this method to the MNIST project mentioned above. The MNIST dataset contains images of handwritten numbers stored as 28by28 arrays and each element of the array represents a pixel value in the image as shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/28/1*951T5qDthqO56TLsiQRJVQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/561/1*hJTFrFK1oICT9kqeoKQf3Q.png" /></figure><p>Our task is to differentiate between handwritten 3’s and 7’s and this requires us to classify images into 1 of 2 classes. Considering the number of classes, the most basic baseline would be 50% — the probability of a correct prediction. This means that any model that performs below this baseline is a waste of time since it’s worse than random guessing.</p><p>The probability of a correct prediction can act as a baseline but it’s a very poor choice because a good baseline requires you to put thought into creating it. This means that where possible, your baselines should already be better than random guessing before you decide to use it as a baseline.</p><p>For the MNIST problem, we’ll try out two different classification methods to identify the best baseline, these two methods are:</p><p>· Pixel similarity</p><p>· Partial pixel similarity using non-zero pixel values</p><p><strong>Method 1 — Pixel Similarity</strong></p><p>As mentioned earlier, the MNIST images are stored as 28 by 28 arrays and the training set contains over twelve thousand images classified as either 3’s or 7’s. If we find the average of all the arrays in each class, the resultant arrays will represent what we define as the ideal 3 and the ideal 7.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/68/1*-GhznMA2cz_ZcYrHteMPzQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/68/1*DJzi6mbStGOpxAH1pFJ-9Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VEejDc_UE8mqzXSANyNPHQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8Kdwa6k3g75m4e9RHd4wxg.png" /><figcaption>Images and arrays of the ideal 3 &amp; 7</figcaption></figure><p>After getting the ideal images, we classify new images using the following steps:</p><p>I. Subtract the array representing the new image from that of the ideal 3</p><p>II. Find the absolute value of the resulting array</p><p>III. Find the mean of the array of absolute values — this is the distance between the new image and the ideal 3</p><p>IV. Repeat step 1–3 but with the ideal 7 instead of the ideal 3</p><p>V. Compare the distances of the new image from the ideal 3 and ideal 7</p><p>VI. If the image is closer to the ideal 3, classify the image as a 3 else classify it as a 7</p><p>This method was obtained from the <a href="https://course.fast.ai/">fastai MOOC</a> and by applying it to the MNIST dataset, the resulting model was able to classify images in the validation set with an accuracy of 95%.</p><p>The code used to implement this solution can be found <a href="https://colab.research.google.com/drive/1HQHfIH0u8TnW5C19zFkrFviHc4w-Wx9b?usp=sharing">here</a>.</p><p><strong>Method 2 — Partial pixel similarity using non-zero pixel values</strong></p><p>This method of classifying the MNIST images was devised by observing the general structure of the digits 3 &amp; 7. This observation showed that the lower part of the number three tends to be a curve while that of a seven tends to be a straight line. This property can be observed below in the images of the ideal 3 and 7 below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2G4vYYPiStJAKTNZ2zs6Ag.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z97YdqIzeYokSK_sUSTT9Q.jpeg" /><figcaption>Different lower halves of 3s and 7s</figcaption></figure><p>Based on this observation, the lower part of the digit 3 is expected to have more non-zero value pixels than that of the digit 7 — because the curves of a lower part 3 tend to be longer than the straight lines of the bottom half of a 7. The model based on this method was developed and utilized as follows:</p><p><strong>Training</strong></p><p>I. Import only the lower half of all arrays representing the digit 3 in the training set</p><p>II. Count the number of non-zero values in each array</p><p>III. Find the average number of non-zero pixels in the lower half of a ‘3’ — ideal 3</p><p>IV. Repeat steps 1–3 for all images of 7’s to find the average number of non-zero pixels in the lower half of a ‘7’ — ideal 7</p><p><strong>Classification</strong></p><p>To classify a new image:</p><p>I. Find the number of non-zero values in the lower half of the image array</p><p>II. Find the absolute distance between number of non-zero values and the number of non -zero values in the lower half of an ideal 3</p><p>III. Find the absolute distance between number of non-zero values and the number of non -zero values in the lower half of an ideal 7</p><p>IV. If the image is closer to the ideal 3, classify the image as a 3 else classify it as a 7</p><p>This method was created by the author of this article and by applying it to the MNIST dataset, the resulting model was able to classify images in the validation set with an accuracy of 80%.</p><p>The code used to implement this solution can be found <a href="https://colab.research.google.com/drive/1HQHfIH0u8TnW5C19zFkrFviHc4w-Wx9b?usp=sharing">here</a>.</p><p><strong>Conclusion</strong></p><p>Method 1 and 2 were used to execute the desired tasks with accuracy of 95% and 80% respectively. Considering this performance, we can select a baseline well above 95% and judge all our models using this baseline. In a case like this where we have very high baselines, it’ll be wise to take a step back and assess the need for an AI solution in the first place. You might find that your solution works perfectly well with the simple baseline solution and you can avoid the investment required for an AI project.</p><p>A baseline encourages you to fully explore your problem before throwing AI at it. It also creates a metric which you can use to judge the true performance value of your complex machine learning solutions. Where possible, it is always advisable to find a baseline for AI projects.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Ftenor.com%2Fembed%2F10584134&amp;display_name=Tenor&amp;url=https%3A%2F%2Ftenor.com%2Fview%2Fclapping-leonardo-dicaprio-leo-dicaprio-gif-10584134&amp;image=https%3A%2F%2Fc.tenor.com%2FWn3myRMF-xAAAAAC%2Fclapping-leonardo-dicaprio.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=tenor" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/639687ea19c70c6ebce0993ec6b290e5/href">https://medium.com/media/639687ea19c70c6ebce0993ec6b290e5/href</a></iframe><p>If you found this article useful, please give it a few claps, thanks.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=80aa93bfa808" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Build an Image-Classification Data Set in 20 Minutes]]></title>
            <link>https://medium.com/better-programming/build-an-image-classification-dataset-in-20-minutes-f7060091e81b?source=rss-8124a856b006------2</link>
            <guid isPermaLink="false">https://medium.com/p/f7060091e81b</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[image-classification]]></category>
            <dc:creator><![CDATA[Samuel Ogbonna]]></dc:creator>
            <pubDate>Sun, 06 Dec 2020 18:28:34 GMT</pubDate>
            <atom:updated>2021-04-11T14:14:48.221Z</atom:updated>
            <content:encoded><![CDATA[<h3>Build a Basic Image-Classification Data Set in 20 Minutes</h3><h4>Learn how to curate datasets that fit your use case</h4><figure><img alt="A digital illustration of a camera lens surrounded by digital photos." src="https://cdn-images-1.medium.com/max/1024/1*EZexWJD5uC-fcUQzP2Dusg.jpeg" /><figcaption>Image by Gerd Altmann from Pixabay</figcaption></figure><p>The biggest flaw with most online deep learning courses is that most of them use data that’s been cleaned and prepared for their learners. This means learners miss out on the crucial step of curating a data set. This skill gap usually reveals itself when you have an interesting idea and you don’t have any idea how to start working on it.</p><p>I experienced this problem after completing my first data science course. The course had a section on image classification using convolutional neural networks (CNNs), and the project used for demonstration was a dog-breed classifier using images from ImageNet.</p><p>It was an interesting project, but it taught me nothing about curating a data set. I almost gave up in frustration after that course, and my progress slowed — until recently when I started taking the “<a href="https://course.fast.ai/">Practical Deep Learning for Coders</a>” course by fast.ai. The course is structured in a way that gives students an end-to-end view of the AI process.</p><p>In the image-classification section of the course, students are shown how to build a data set using the Bing image search API — the process returns images related to selected search terms.</p><p>This opened a door in my mind, and after a bit of research, I found a way to achieve the same thing without a need for Microsoft accounts, API keys, and all the extras involved in working with the API.</p><p>To build your own image-classification data set in less than 30 minutes, follow the steps below.</p><h3><strong>1. Install the Bing Image Downloader Library</strong></h3><p>This can be done in the terminal by running the command below:</p><pre>pip install bing-image-downloader</pre><p>More information about this library can be found <a href="https://pypi.org/project/bing-image-downloader">here</a>.</p><h3><strong>2. Download Data for Each Class in Your Data Set</strong></h3><p>This can be done with as little as two lines of code, as seen in the sample below.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3d7a10fd97d10d9646b6d3dbbaa6288f/href">https://medium.com/media/3d7a10fd97d10d9646b6d3dbbaa6288f/href</a></iframe><p>The key parameters to consider here are:</p><ul><li>query: The search term for images. The sample above is expected to return images that are related to Budweiser.</li><li>limit: The number of images you want to download for the search term. Limiting this is good because the more images you download, the more irrelevant images you’ll get. I’ve found 150 to be a sensible limit in most cases.</li><li>output_dir: This is the path to the directory where the folders containing the images will be stored</li></ul><p>The code above will create a folder named beer and create two folders within it. The first one will be a budweiser beer folder, containing images related to Budweiser, and the second one will be a corona beer folder, containing images related to Corona beer.</p><h3><strong>3. Browse Through Images, Deleting Irrelevant Ones</strong></h3><figure><img alt="On the left is a picture of Corona beer and on the right is a picture of people in medical safety gear." src="https://cdn-images-1.medium.com/max/303/1*ru-XFc38COL5UyNfQs9L4g.jpeg" /><figcaption>Searching for Corona beer also brings up images related to the virus</figcaption></figure><p>There will unavoidably be a few irrelevant images in the generated data set. It’s enough to do a quick visual scan through all of the downloaded images and delete any images that don’t fit within your aim for the model.</p><p>Now you have a data set that contains relevant images grouped according to their classes. In my next article, I’ll show you how to train a custom-image classifier in less than 25 lines of code — sounds awesome, right?</p><p><strong>Disclaimer: </strong>Using the images for personal projects is fine, but in the case of commercial projects, make sure you’re not breaching privacy, intellectual property, or any other relevant laws.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f7060091e81b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/better-programming/build-an-image-classification-dataset-in-20-minutes-f7060091e81b">Build an Image-Classification Data Set in 20 Minutes</a> was originally published in <a href="https://betterprogramming.pub/">Better Programming</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to get a Udacity Nanodegree for less than half-price]]></title>
            <link>https://medium.com/swlh/how-to-get-a-udacity-nanodegree-for-less-than-half-price-3fab495a18d7?source=rss-8124a856b006------2</link>
            <guid isPermaLink="false">https://medium.com/p/3fab495a18d7</guid>
            <category><![CDATA[udacity-nanodegree]]></category>
            <category><![CDATA[saving]]></category>
            <category><![CDATA[upskilling]]></category>
            <category><![CDATA[programming-tips]]></category>
            <dc:creator><![CDATA[Samuel Ogbonna]]></dc:creator>
            <pubDate>Sun, 03 May 2020 13:40:23 GMT</pubDate>
            <atom:updated>2020-05-03T13:40:23.877Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NvviAeiCTlV6p2PyTyklxQ.jpeg" /><figcaption>Image by 3D Animation Production Company from Pixabay</figcaption></figure><p>The Udacity nanodegree is a project and skills-based educational credential program that basically teaches you key skills in a specific field, guides you to apply them in projects and then assures the rest of the word you’ve gained those skills (with a certificate).</p><p>The nanodegree is great because it offers a structured learning path that comes with projects, reviewers to guide you through the projects, professional guidance and a community of other learners who are going through a similar nanodegree journey.</p><p>Unfortunately, all this great stuff comes at quite a steep cost — $399/month at the time of writing this article. Udacity estimates that it’ll take you four months to get through this so a nanodegree should cost you a total of $1596.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FlZ68jJIzPEnU4%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FlZ68jJIzPEnU4%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FlZ68jJIzPEnU4%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="174" frameborder="0" scrolling="no"><a href="https://medium.com/media/8cf580903ecd5e0a9f5e377b348a4be2/href">https://medium.com/media/8cf580903ecd5e0a9f5e377b348a4be2/href</a></iframe><p>A lot of people are immediately scared off by this price tag but in this article I bring hope. I’ve completed two Udacity nanodegrees (check them out <a href="https://confirm.udacity.com/FDGHPVMN">here</a> and <a href="https://confirm.udacity.com/RP69Q273">here</a>) and I only paid 25% of the cost for both of them because I completed each of them in 1 month — as opposed to the recommended 4-month period.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*ONRUxMakfhHA4gPNKLv7KA.gif" /></figure><p>DISCLAIMER: While getting both of my nanodegrees, I wasn’t working a full-time job so I could dedicate about 4 hours a day to learning. Even if you can’t do the same, following the tips below will help to significantly shorten the time you spend getting your nanodegree.</p><p>Now to the main course; getting a nanodegree in 1 month isn’t very difficult if you follow the 4 tips below. As you read through the tips keep in mind that in the nanodegree savings game, time = money and time wasters steal money from us.</p><p><strong>1.</strong> <strong>Master the Prerequisites</strong></p><p>This tip is super important because it can help you avoid one of the biggest time wasters in nanodegree programs.</p><p>For every nanodegree, Udacity provides a list of tools and topics which students are expected to understand before starting the program. Many people rush into the program without mastering these basics and end up wasting time learning them during the course (while paying for the time). If you master the prerequisites, you’ll fly through the nanodegree curriculum because your energy will only be required for learning new concepts from the nanodegree.</p><p><strong>2.</strong> <strong>Complete every exercise Yourself</strong></p><p>This may seem counterintuitive but it’s super important that you complete every exercise while going through the learning modules. Exercises can get complicated and take a lot of time but they’re useful because they force you to apply new concepts as you learn them. If you do all the exercises by completing all quizzes and writing all the required code, you’ll win back all the lost time during your projects. I completed every project –including the capstone- in less than a day because I had a solid understanding of all the principles required to complete the projects.</p><p>So don’t be worried when a coding exercise takes half an hour because cracking it means you’re better equipped to handle the final project.</p><p><strong>3.</strong> <strong>Share your projects for exposure and motivation</strong></p><p>Motivation is key if you want to keep up the intense work schedule and one good way to keep up your motivation is to share the projects you complete as you go through the nanodegree. It’s awesome when you get people’s feedback and they begin to acknowledge your skill in your new area of specialization.</p><p>Another good source of motivation is the $1197 you’re going to save by putting in the work.</p><p><strong>4.</strong> <strong>Spend at least 4 hours a day learning</strong></p><p>There’s no way around this if you want to finish the degree in less than a month. All the tips above help make the process easier but at the end of the day, you still have to be willing to sit down with your laptop and get some work done.</p><p>If you put in 4 hours of more while following all the tips above, I can guarantee that you’ll comfortably finish your nanodegree in less than a month.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FH7Zog60Ul6FMr4dX7G%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FH7Zog60Ul6FMr4dX7G%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FH7Zog60Ul6FMr4dX7G%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="244" frameborder="0" scrolling="no"><a href="https://medium.com/media/a09e3d37d32bfd3fa8387d3abc720820/href">https://medium.com/media/a09e3d37d32bfd3fa8387d3abc720820/href</a></iframe><p>If you follow the tips above, you’ll get your desired skills and certification while saving 75% of the nanodegree cost.</p><p>If you want even more extreme savings, wait till Udacity has a special offer on their nanodegree price before starting the course. I personally did this and ended up with a nanodegree for only $150.</p><p>If you’ve found this article informative or helpful to you, please give it a few claps.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3fab495a18d7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swlh/how-to-get-a-udacity-nanodegree-for-less-than-half-price-3fab495a18d7">How to get a Udacity Nanodegree for less than half-price</a> was originally published in <a href="https://medium.com/swlh">The Startup</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Udacity Capstone: Identifying Dog Breeds Using Convoluted Neural Networks]]></title>
            <link>https://medium.datadriveninvestor.com/udacity-capstone-identifying-dog-breeds-using-convoluted-neural-networks-c266cfd42b80?source=rss-8124a856b006------2</link>
            <guid isPermaLink="false">https://medium.com/p/c266cfd42b80</guid>
            <category><![CDATA[convolutional-neural-net]]></category>
            <category><![CDATA[image-classification]]></category>
            <category><![CDATA[python-programming]]></category>
            <category><![CDATA[udacity]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Samuel Ogbonna]]></dc:creator>
            <pubDate>Tue, 21 Apr 2020 09:39:53 GMT</pubDate>
            <atom:updated>2020-12-04T10:04:42.751Z</atom:updated>
            <content:encoded><![CDATA[<h3>Udacity Capstone: Identifying Dog Breeds Using Convolutional Neural Networks</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3edhScjT2zbdhAQBpgYc2Q.jpeg" /></figure><p>According to the American Kennel Club, there are 149 breeds of dogs. Some sources claim this number should be over 300 but it’s safe to say there are a LOT of dog breeds. The average person would struggle to find the time or motivation to memorize the features of each dog breed and it would be a stretch to expect any one person to have the skill of instantly identifying a dog’s breed on sight.</p><p>It’s in cases like this we get a chance to apply data science techniques to enable computers to fill the gap that human beings struggle to consistently fill. For this project, the goal is to use a Convolutional Neural Network (CNN) to classify images of dog’s according to their breed when given a picture of the dog as input.</p><p>The project was executed in a Udacity workspace and data for the project was already loaded into the workspace. The data for training the CNN can, however, be downloaded <a href="https://s3-us-west-1.amazonaws.com/udacity-aind/dog-project/dogImages.zip">here</a>.</p><p><a href="https://www.datadriveninvestor.com/2020/02/19/five-data-science-and-machine-learning-trends-that-will-define-job-prospects-in-2020/">Five Data Science and Machine Learning Trends That Will Define Job Prospects in 2020 | DataDrivenInvestor</a></p><p>The project is part of the Udacity nanodegree program and the end product is an algorithm that will use a CNN to do the following when supplied an image as input:</p><p>1. Detect human faces in the input image</p><p>2. Detect dog faces in the input image</p><p>3. Predict the dog’s breed if it detects a dog</p><p>4. Predict the dog breed that most resembles any human face it detects</p><p>For this article, the execution of the project will be covered in the following steps:</p><p>· Detecting humans in the image</p><p>· Detect dogs in the image</p><p>· Build a CNN from scratch to Classify Dog Breeds</p><p>· Build a CNN using transfer learning to Classify Dog Breeds (using Transfer Learning)</p><p>· Code an algorithm that combines all the steps above</p><p>· Test the Algorithm</p><p><strong>Detecting humans in the image</strong></p><p>Detection of human faces in the image was implemented with python using the face_recognition library (documentation <a href="https://pypi.org/project/face-detector/">here</a>). The library provides a simple way to implement face detection in images and when tested on a subset of images, it had a higher accuracy than the implementation recommended by Udacity which used the OpenCV library to detect the faces. The two face detection implementations are shown below, they were tested on a set of 200 images where 100 contained dogs and 100 contained humans.</p><p>Implementation of face detection using the OpenCV.</p><pre>#Define a function that returns true if it detects a human face</pre><pre>def face_detector(img_path):<br> img = cv2.imread(img_path)<br> gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)<br> faces = face_cascade.detectMultiScale(gray)<br> return len(faces) &gt; 0</pre><p>With this implementation, faces were detected for 100% of human images and 11% of dog images.</p><pre>#Import the relevant library<br>import face_recognition</pre><pre>#Define a function that returns true if it detects a human face</pre><pre>def face_detector(path):<br>    image = face_recognition.load_image_file(path)<br>    face_locations = face_recognition.face_locations(image)<br>    return len(face_locations) &gt; 0</pre><p>Above is the face detector implemented using the face_recognition library. With this implementation, faces were detected for 100% of human images and 10% of dog images.</p><pre>##Test the performance of the face_detector algorithm on the images in human_files_short and dog_files_short.</pre><pre>#Import files for testing the face detector</pre><pre>human_files_short = human_files[:100]<br>dog_files_short = train_files[:100]</pre><pre>#Instantiate counters for the number of faces detected in each set <br>dog_count, human_count = 0,0</pre><pre>#Loop through all images and try detecting a face<br>for count in range(100):<br>    if face_detector(dog_files_short[count]):<br>        dog_count+=1<br>        <br>    if face_detector(human_files_short[count]):<br>        human_count+=1<br>        <br>print(&#39;Faces were detected for {0}% of human images&#39;.format(human_count))</pre><pre>print(&#39;Faces were detected for {0}% of dog images&#39;.format(dog_count))</pre><p>From the test conducted using the code above, we find that neither model is perfect but the second implementation produces slightly superior results on the selected date.</p><p><strong>Detecting dogs in the image</strong></p><p>Detecting dogs in the input image was executed using the Resnet 50 CNN architecture and the imagenet database. The CNN was imported using the code below.</p><pre>from keras.applications.resnet50 import ResNet50</pre><pre># define ResNet50 model<br>ResNet50_model = ResNet50(weights=&#39;imagenet&#39;)</pre><p>The process of detecting the dogs in the input images consisted of two steps. The first step was to process the incoming image data and the second step was making predictions based on the processed images.</p><p><strong>Preprocessing</strong></p><p>Before we can pass our data into the Resnet 50 model for prediction, we’ll need to carry out some preprocessing on the image data. We do this because Keras CNNs using TensorFlow as backend require the input to be a 4D array. The input array will be of the form:</p><p>(number of samples, rows, columns, channels)</p><p>To achieve the following functions were defined:</p><p><strong>Path_to_tensor</strong>: This function takes in a string-valued file path to a colour image as input and returns a 4D tensor suitable for supplying to a Keras CNN. The function first loads the image and resizes it to a square image that is 224×224 pixels. The image is then converted to an array, which is then resized to a 4D tensor. In this case, since we are working with colour images, each image has three channels.</p><p><strong>Paths_to_tensor: </strong>This function takes a NumPy array of string-valued image paths as input and returns a 4D tensor with the required shape. The final step to be taken before our data is ready for the model involves the additional normalization step of taking the mean pixel values of all pixels in all images in ImageNet — expressed in RGB as [103.939,116.779,123.68]- and subtracting it from every pixel in each image. This is implemented in the imported function preprocess_input which can be found <a href="https://github.com/fchollet/keras/blob/master/keras/applications/imagenet_utils.py">here</a>.</p><p>The code for both functions is shown below.</p><pre>from keras.preprocessing import image                  <br>from tqdm import tqdm</pre><pre>def path_to_tensor(img_path):<br>    # loads RGB image as PIL.Image.Image type<br>    img = image.load_img(img_path, target_size=(224, 224))<br>    # convert PIL.Image.Image type to 3D tensor with shape (224, 224, 3)<br>    x = image.img_to_array(img)<br>    # convert 3D tensor to 4D tensor with shape (1, 224, 224, 3) and return 4D tensor<br>    return np.expand_dims(x, axis=0)</pre><pre>def paths_to_tensor(img_paths):<br>    list_of_tensors = [path_to_tensor(img_path) for img_path in tqdm(img_paths)]<br>    return np.vstack(list_of_tensors)</pre><p><strong>Making Predictions</strong></p><p>The function shown below is the one used to make predictions, it uses the predict function to obtain an array for Imagenet’s 1000 classes. We then use NumPy’s argmax function to isolate the class with the highest probability.</p><p>In the output dictionary of Imagenet classes (found <a href="https://gist.github.com/yrevar/942d3a0ac09ec9e5eb3a">here</a>), entries 151 to 269 represent dogs so we write a second function that uses this dictionary to determine if any of the identified objects in the image fall within this range of the dictionary.</p><pre>from keras.applications.resnet50 import preprocess_input, decode_predictions</pre><pre>#Extract the label with the highest probability according to the CNN<br>def ResNet50_predict_labels(img_path):<br>    # returns prediction vector for image located at img_path<br>    img = preprocess_input(path_to_tensor(img_path))<br>    return np.argmax(ResNet50_model.predict(img))</pre><pre>### returns &quot;True&quot; if the extracted label corresponds to a dog <br>def dog_detector(img_path):<br>    prediction = ResNet50_predict_labels(img_path)<br>    return ((prediction &lt;= 268) &amp; (prediction &gt;= 151))</pre><p>The code below was used to test the accuracy of the dog detector and the result was that faces were detected for 0% of human images and dogs in 100% of dog images</p><pre>dog_count = 0 <br>human_count = 0<br>#Loop through all images and try detecting a face<br>for count in range(100):<br>    if dog_detector(dog_files_short[count]):<br>        dog_count+=1<br>        <br>    if dog_detector(human_files_short[count]):<br>        human_count+=1<br>        <br>print(&#39;Dogs were detected for {0}% of human images&#39;.format(human_count))<br>print(&#39;Dogs were detected for {0}% of dog images&#39;.format(dog_count))</pre><p><strong>Build a CNN from scratch to Classify Dog Breeds</strong></p><p>Even though the goal of the project is to build a dog breed classifier using transfer learning, this part of the project was useful for understanding the fundamental of CNNs and how they work.</p><p>The network I settled on for the CNN was designed to reduce the dimensionality of the images by making the matrixes deeper than they were high or wide. Dimensionality reduction was done using max-pooling layers while the depth of the image was increased using the convolutional layers.</p><p>A GAP layer was used to flatten the array before adding fully connected layers that ended with a fully connected layer with 133 nodes — the same as the number of dog breeds. Dropout layers were used to reduce the possibility of overfitting.</p><p>The model was compiled with rmsprop as the optimizer for the categorical cross-entropy based loss function.</p><pre>from keras.layers import Conv2D, MaxPooling2D, GlobalAveragePooling2D<br>from keras.layers import Dropout, Flatten, Dense<br>from keras.models import Sequential</pre><pre>model = Sequential()<br>model.add(Conv2D(filters = 16, kernel_size = 2, padding = &#39;same&#39;, activation = &#39;relu&#39;, input_shape = (224, 224, 3)))<br>model.add(MaxPooling2D(pool_size = 4, padding = &#39;same&#39;))<br>model.add(Conv2D(filters = 32, kernel_size = 2, padding = &#39;same&#39;, activation = &#39;relu&#39;))<br>model.add(MaxPooling2D(pool_size = 4, padding = &#39;same&#39;))<br>model.add(Conv2D(filters = 64, kernel_size = 2, padding = &#39;same&#39;, activation = &#39;relu&#39;))<br>model.add(MaxPooling2D(pool_size = 2, padding = &#39;same&#39;))<br>model.add(Dropout(0.3))<br>model.add(GlobalAveragePooling2D())<br>#model.add(Flatten())<br>model.add(Dense(200, activation = &#39;relu&#39;))<br>model.add(Dropout(0.4))<br>model.add(Dense(133, activation = &#39;softmax&#39;))</pre><pre>model.summary()</pre><figure><img alt="Summary of the specified CNN architecture." src="https://cdn-images-1.medium.com/max/478/1*1jHaVtJ6pszP4rnjAvbfTQ.png" /></figure><p>The target for this task was to build a CNN with an accuracy greater than &gt;1%. The network described above achieved 18.062% without any fine-tuning of parameters or data augmentation.</p><p><strong>Build a CNN using transfer learning to Classify Dog Breeds</strong></p><p>This part of the project involved leveraging on pre-existing models to improve the accuracy of my CNN. This was achieved by cutting off the final classifying layers of the preexisting CNN and appending classifying layers of my design. After this application, the entire model would be trained on the dog image dataset to tune the weights of the added layers while maintaining the weights from the original model.</p><p>This approach will make the training of the new CNN very quick, as we are applying images where the main features for identification have already been isolated. This means we will have only a small number of parameters or weights to back-propagate through.</p><p>I chose to build my CNN by leveraging a Resnet 50 CNN trained on the imagenet database. Bottleneck features for the Resnet 50 model exist and I only had to download the file for our Resnet 50 CNN before importing it with the code shown below.</p><pre>### TODO: Obtain bottleneck features from another pre-trained CNN.</pre><pre>bottleneck_features = np.load(&#39;bottleneck_features/DogResNet50Data.npz&#39;)<br>train_Resnet50 = bottleneck_features[&#39;train&#39;]<br>valid_Resnet50 = bottleneck_features[&#39;valid&#39;]<br>test_Resnet50 = bottleneck_features[&#39;test&#39;]</pre><p>The <strong>model architecture</strong> is shown below. I experimented by trying several different combinations with 1 and 2 fully connected layers with 200 and 400 nodes, different rates of dropout (0.4 and 0.5) and different optimizers (Adam, rmsprop). All the different architectures gave me testing accuracies of between 79% and 83%.</p><p>The final layer is 133 nodes to match the number of our classes.</p><p>The architecture below has a testing accuracy of 82.656%</p><pre>### TODO: Define your architecture.<br>trans_model = Sequential()</pre><pre>trans_model.add(GlobalAveragePooling2D(input_shape=train_Resnet50.shape[1:]))<br>trans_model.add(Dense(200, activation = &#39;relu&#39;))<br>trans_model.add(Dropout(0.4))<br>trans_model.add(Dense(133, activation = &#39;softmax&#39;))</pre><pre>trans_model.summary()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/483/1*e6NLZ4Bo4fQBnFWQ29iukg.png" /></figure><p>After defining the architecture, it was compiled and trained using the code below.</p><pre>### TODO: Compile the model.<br>trans_model.compile(loss = &#39;categorical_crossentropy&#39;, optimizer = &#39;rmsprop&#39;, metrics = [&#39;accuracy&#39;])</pre><p>We track all the epochs and load back the best parameters to make sure our CNN has the weights with the highest accuracy achieved in our training process.</p><pre>### TODO: Train the model.</pre><pre>from keras.callbacks import ModelCheckpoint</pre><pre>epochs = 50</pre><pre>checkpointer = ModelCheckpoint(filepath=&#39;saved_models/weights.best.trans.hdf5&#39;, verbose=1, save_best_only=True)</pre><pre>trans_model.fit(train_Resnet50, train_targets, validation_data=(valid_Resnet50, valid_targets),epochs=epochs, batch_size=20, callbacks=[checkpointer], verbose=1)</pre><pre>trans_model.load_weights(&#39;saved_models/weights.best.trans.hdf5&#39;)</pre><p>We test the accuracy of the model implemented with the code below and get an accuracy of 80.502%.</p><pre>### TODO: Calculate classification accuracy on the test dataset.</pre><pre># get index of predicted dog breed for each image in test set<br>new_dog_breed_predictions = [np.argmax(trans_model.predict(np.expand_dims(tensor, axis=0))) for tensor in test_Resnet50]</pre><pre># report test accuracy<br>test_accuracy = 100*np.sum(np.array(new_dog_breed_predictions)==np.argmax(test_targets, axis=1))/len(new_dog_breed_predictions)<br>print(&#39;Test accuracy: %.4f%%&#39; % test_accuracy)</pre><p>After training the model, the next step was to put it into a function that would take in an image path and predict the breed of dog in the image. The function defined for this task is shown below.</p><pre>### TODO: Write a function that takes a path to an image as input<br>### and returns the dog breed that is predicted by the model.</pre><pre>from extract_bottleneck_features import *</pre><pre>def Resnet50_predict_breed(img_path):<br>    # extract bottleneck features<br>    bottleneck_feature = extract_Resnet50(path_to_tensor(img_path))<br>    # obtain predicted vector<br>    predicted_vector = trans_model.predict(bottleneck_feature)<br>    # return dog breed that is predicted by the model<br>    pred1 = re.sub(r&#39;[0-9]&#39;, &#39;&#39;, dog_names[np.argmax(predicted_vector)][11:])<br>    prediction = re.sub(r&#39;_&#39;, &#39; &#39;, pred1)<br>    return prediction</pre><p><strong>Write your Algorithm that combines all the steps above</strong></p><p>To cap off all the work up to this point, a function was built. The function accepts a file path to an image and first determines whether the image contains a human, dog, or neither. Then,</p><ul><li>if a <strong>dog</strong> is detected in the image, return the predicted breed.</li><li>if a <strong>human</strong> is detected in the image, return the resembling dog breed.</li><li>if <strong>neither</strong> is detected in the image, provide an output that indicates an error.</li></ul><p>We make use of the face detector and dog detector functions specified earlier in the project to detect the human and dog faces in the picture. The algorithm takes in an image path and acts based on the requirements describes above.</p><pre>### TODO: Write your algorithm.<br>### Feel free to use as many code cells as needed.</pre><pre>def dog_breed_detector(path):<br>    <br>    print(&#39;---------Started----------&#39;)<br>    <br>    #Display the image<br>    display_image(path)<br>    <br>    if dog_detector(path):<br>        breed = Resnet50_predict_breed(path)<br>        print(&#39;This dog is a &#39; + breed)<br>    <br>    elif new_face_detector(path):<br>        breed = Resnet50_predict_breed(path)<br>        print(&quot;This human resembles a &quot; + breed)<br>    else:<br>        print(&quot;Theres neither a human nor a dog in this picture, review the input image&quot;)<br>    pass</pre><p><strong>Test the algorithm</strong></p><p>My ability to test the algorithm was limited by the fact that I don’t have a large number of pictures for testing but the model performed satisfactorily on the test pictures as shown below.</p><pre>import os</pre><pre>listr = [(str(i)[11:-2]) for i in os.scandir(&#39;images&#39;)]<br>del(listr[11])<br>print(listr)</pre><pre>for x in listr:<br>    dog_breed_detector(&#39;images/&#39; + x)<br>    print (&#39;/n&#39;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/323/1*FANaDKtE0tlgP3nlp6FhVw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/291/1*Jq8pwcA1_8ZVeWLe4_ToQA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/513/1*acH498DLwY6JNVBWlwx5-Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/270/1*AmfId9jn_K0n4Lo03mc5BQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/303/1*WdKlEkavl3Wb0nWEjmdfwA.png" /><figcaption>Images tested with the algorithm. Apparently I look like an American Foxhound</figcaption></figure><p><strong>Reflection</strong></p><p>The model performed satisfactorily but it failed to hit the accuracy mark of 90%. The results obtained can, however, be improved by:</p><p>· Increasing the quality of training data by providing a larger dataset and reviewing the images to ensure that they aren’t skewed towards one breed, blurry or defective in any way that negatively affects the CNN.</p><p>· Data augmentation which would involve using the Keras ImageDataGenerator class to carry out data augmentation on the training data.</p><p>· Further hyperparameter tuning</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2Fb2a0d6%3Fas_embed%3Dtrue&amp;dntp=1&amp;display_name=Upscribe&amp;url=https%3A%2F%2Fupscri.be%2Fb2a0d6%2F&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/0707f5c806284d01a4a13c7b13a91ce3/href">https://medium.com/media/0707f5c806284d01a4a13c7b13a91ce3/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c266cfd42b80" width="1" height="1" alt=""><hr><p><a href="https://medium.datadriveninvestor.com/udacity-capstone-identifying-dog-breeds-using-convoluted-neural-networks-c266cfd42b80">Udacity Capstone: Identifying Dog Breeds Using Convoluted Neural Networks</a> was originally published in <a href="https://medium.datadriveninvestor.com/">DataDrivenInvestor</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[World Cup + Data Science = The end of all football arguments]]></title>
            <link>https://samuelchimaogbonna.medium.com/world-cup-data-science-the-end-of-all-football-arguments-22be5ab70645?source=rss-8124a856b006------2</link>
            <guid isPermaLink="false">https://medium.com/p/22be5ab70645</guid>
            <category><![CDATA[python-programming]]></category>
            <category><![CDATA[football]]></category>
            <category><![CDATA[world-cup]]></category>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Samuel Ogbonna]]></dc:creator>
            <pubDate>Sun, 29 Mar 2020 20:56:58 GMT</pubDate>
            <atom:updated>2020-03-29T20:56:58.845Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Aq6Otdf3VEMp2xtbpDm4tw.jpeg" /></figure><blockquote>The world cup is the biggest football event in the world. I think it’s the biggest event in the world because what can beat such an intense combination of football passion, national pride and age-old international rivalries across billions of people in 6 different continents (7 if there are football fans on Antarctica — I don’t know).</blockquote><p>So as a long time football fan and aspiring data scientist, it’s only logical that my first major project involves analyzing and visualizing data about the world cup.</p><p>The data I used for this project is from the FIFA world cup archives and it covers everything from competition level data to individual match stats from 1930–2014 (basically from before you were born).</p><p><em>If you’re interested in the Python code I used to generate these visuals and answer the questions, you can find them </em><a href="https://github.com/chimaOG/World-Cup-Data-Analysis"><em>here</em></a><em>.</em></p><p>So without further ado, let’s get to the questions of the day:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F3o7btZ1Gm7ZL25pLMs%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F3o7btZ1Gm7ZL25pLMs%2Fgiphy.gif&amp;image=https%3A%2F%2Fmedia0.giphy.com%2Fmedia%2Fv1.Y2lkPTc5MGI3NjExdzhkcWwwd3RibGVwMXR4ZGx1eTc5a3Y0MG9uYWZ0cHJtajZyNWx4OSZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw%2F3o7btZ1Gm7ZL25pLMs%2Fgiphy_s.gif&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="244" frameborder="0" scrolling="no"><a href="https://medium.com/media/2ca65680ef1e7f1553d7172d6ccfd4dd/href">https://medium.com/media/2ca65680ef1e7f1553d7172d6ccfd4dd/href</a></iframe><p><strong>Question 1: Who is the world cup king?</strong></p><p>This question is difficult to answer for most people because almost every country that has gone past the knockout stage of the competition likes to boast about their ‘rich’ world cup history (rolls eyes). When we cut past the national bias and analyze the data, the answer is super obvious.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/987/1*tmf8pS2yEqpPrfoKGl64hA.png" /><figcaption>World cup winners and their number of world cups (colour encoded by continent)</figcaption></figure><p>BRAZIL!!! The Selecao are the obvious world cup kings because they’ve won more world cups than any other nation. Another interesting thing we notice from this chart is that all the world cup winners in history come from either Europe or South America. South America has the King (Brazil) but Europe has more world cups and a higher number of individual winners.</p><p>Based on these facts, I hereby declare Brazil the King amongst nations and Europe the king amongst continents.</p><h3><strong>Question 2: Which Teams Form the Elite World Cup Club?</strong></h3><p>Some countries — who haven’t won any trophy — might argue that they’ve contributed a lot to the world cup’s history with their stellar performances. After rolling my eyes at the statements, I decided to further investigate.</p><p>My goal was to identify the 15 teams who have scored the most goals and the 15 teams with the highest match attendance. The first visual below shows the 15 teams with the most goals (coloured red) while the second visual below shows the 15 teams with the highest match attendance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/821/1*-HfFoFwBu-nZMeWe2S9U6A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/824/1*a5dqhJTxCMIIEyLgP0nvqA.png" /><figcaption>15 Nations with the Highest Goals and Match Attendance in the World Cup(High scoring teams are coloured red)</figcaption></figure><p><strong>Note: Teams highlighted in red are top goal-scoring teams with high attendance</strong></p><p>If you observe both charts, you’ll see that they’re almost identical. The differences can be explained by the fact that:</p><p>· Yugoslavia and the Soviet Union no longer exist</p><p>· Hungary has a relatively tiny population — leading to low attendance</p><p>· USA, Switzerland and South Korea have all hosted world cups — boosting their attendance.</p><p>So at the end of the day, it’s obvious that the same teams that consistently score more goals get more people into the stadiums and based on this, the world cup elite teams are:</p><blockquote>Brazil, Germany, Italy, Argentina, France, England, Spain, Netherlands, Mexico, Uruguay, Sweden, Belgium</blockquote><p>If your country isn’t on this list, you’re not from a world cup heavyweight.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FfV8iuSEwLQ6005diSh%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FfV8iuSEwLQ6005diSh%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FfV8iuSEwLQ6005diSh%2Fgiphy.gif&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="285" frameborder="0" scrolling="no"><a href="https://medium.com/media/ca808bc52878551cb9a1c382a3f6d230/href">https://medium.com/media/ca808bc52878551cb9a1c382a3f6d230/href</a></iframe><h3><strong>Question 3: Has the Number of Goals per World Cup changed over time?</strong></h3><p>This is a pretty straightforward one. I want to know if world cups now have more goals than they used to be. The graph below shows how the number of goals per world cup has changed over time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/983/1*v1s7jJqSvtvclYCkRsLibw.png" /></figure><p>You might be tempted to look at this and assume that the number of goals per world cup is increasing but you have to consider that the number of teams in the world cup — and by extension, the number of matches — has increased over the years.</p><p>To identify the effect of the increase in the number of matches on the number of goals per tournament, the visual below was created and by looking at it, we see that the actual number of goals per world cup match hasn’t changed much (except for spikes in the 1954 and 1958 world cups ) but we have more goals per tournament because we have more teams.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/826/1*ILyjgHWLAFL3N7bnTO445g.png" /><figcaption>Goals Scored VS Number of Teams Over Time</figcaption></figure><h3><strong>Conclusion</strong></h3><p>Football arguments can get very emotional but today we’ve dealt with cold hard numbers.</p><blockquote>The fact is that:</blockquote><blockquote>· Brazil is the world cup king</blockquote><blockquote>· Europe is the most successful footballing continent</blockquote><blockquote>· Brazil, Germany, Italy, Argentina, France, England, Spain, Netherlands, Mexico, Uruguay, Sweden and Belgium make up the world cup elite.</blockquote><blockquote>· There hasn’t been a big change in the number of goals per match</blockquote><blockquote>· You enjoyed this article so much you’re going to clap for it : D</blockquote><p>If you have any questions you’d like answered about the world cup, drop a comment and I’ll jump right on it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=22be5ab70645" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Preparing for Life’s Uncertainty]]></title>
            <link>https://samuelchimaogbonna.medium.com/preparing-for-lifes-uncertainty-be908856658c?source=rss-8124a856b006------2</link>
            <guid isPermaLink="false">https://medium.com/p/be908856658c</guid>
            <category><![CDATA[life-lessons]]></category>
            <category><![CDATA[goal-setting]]></category>
            <category><![CDATA[self-development]]></category>
            <dc:creator><![CDATA[Samuel Ogbonna]]></dc:creator>
            <pubDate>Sun, 26 Jan 2020 18:29:54 GMT</pubDate>
            <atom:updated>2020-01-26T23:47:36.380Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SrVXlSjKUT4I1jt-6jyhiw.jpeg" /><figcaption>Picture obtained from Pixabay</figcaption></figure><p>One big part of life after school is getting used to the fact that life loses its structure to a large extent. As a student, I could always predict the next few years because I was going through an educational system that had a clear design. My major life goal at the time was to pass my exams; it was remarkably simple and easy to implement because I knew the outcome of not pursuing that goal — failure and repeating that level.</p><blockquote><strong>There are two major differences between my student life and my present one, the first is that life is no longer a designed system with clearly defined consequences and the second is that our choices no longer have very clear outcomes.</strong></blockquote><p>Think about it, some people achieve financial success without going to school while other achieve it by monetizing their PhD research, some people follow the rules their entire life and die average while others break all the accepted rules and become respected and revered members of society. Success takes different forms and whether a person is considered successful or not depends largely on who you’re asking.</p><p>The average person wants to be successful in life. The exact definition of that success is unique to each person but each one of us wishes to be able to look back on our lives and be proud. I have a similar desire but recently, I’ve been unsure about how to go about achieving this goal. The initial plan was for me to get into a graduate program immediately after my national service but six applications later, I had six letters of rejection. I realized that the Master thing wasn’t going to work out immediately and it was a shock to me because the Master’s degree was ‘supposed’ to be the next step.</p><p>I finally understood that the world had changed and things were no longer going to happen because they were supposed to. I eventually got a good job but there’s now the fear of getting sucked into work while watching life go by. Adult life seems to be a balancing act that requires you to comfortably survive in the short term while consistently making efforts towards thriving and achieving your goals in the long term. A good example of this would be killing it at work every day to maintain the monthly salary while making time to grow your side business or whatever scheme you’ve chosen to increase your long term earning power.</p><p>In line with this principle of thriving in the short term and making investments towards long term, I’ve decided to incorporate the following things into my life from this year:</p><p>1. <strong>Journaling</strong></p><p>I plan to keep two journals from now on — a personal one and a work journal. The advantages of journaling are well documented and you can find them with a simple google search. I’ve been consistently journaling since the beginning of the year and it’s been a great tool for examining and expressing emotions, introspection, goal setting and self-discipline. I’m resuming my new job on the 3rd of February and I’m super excited to see the effect of keeping a work journal on my work life.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/723/1*0c2p0HT9AMujRbc8Rzh8UA.png" /><figcaption>Excerpt from a recent journal entry</figcaption></figure><p><strong>2.</strong> <strong>Writing</strong></p><p>My writing will cover my personal life experiences and my journey towards becoming a data scientist. On the personal front, writing consistently will force me to further develop my thoughts on the experiences and occurrences that shape my personality; I also hope that my words will help and inspire other people because I have benefited greatly from the works of other writers. Concerning data science, it is a personal passion of mine which I will pursue intentionally this year. Writing about data science will force me to deepen my understanding of the concepts and expose my thoughts and methods to public scrutiny — I’ll have no other choice but to learn and develop.</p><p>3. <strong>Self-Development</strong></p><p>In this race of life, you’re not allowed to stop learning and improving because immediately you do, you begin to lose relevance. Most of my self-development efforts for this year will be directed towards developing my data science career. Apart from that, I’ll dedicate more time to reading interesting and educating books by intelligent authors.</p><p>4. <strong>Exercise and Dieting</strong></p><p>The short and long term benefits of exercise are undeniable and it would be advisable for every human being to incorporate some form of it into their lives. I plan to work out 3–4 times a week and eat healthier meals than I currently do. I enjoy exercise but dieting has always been a struggle for me because I’m a bit of an emotional eater and a sweet tooth. My plans for achieving my dieting goals will be discussed in another article.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PgNRiSxWPQKG4hblbyDZ6Q.jpeg" /><figcaption>Picture obtained from Pixabay</figcaption></figure><p>Life is unpredictable and the best any man can do is live it in a way that sets him up to efficiently make use of opportunities when they present themselves. Zig Ziglar once said that “success occurs when opportunity meets preparation” and with these steps, I believe that I will be prepared when the appropriate opportunities present themselves to me.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=be908856658c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Moral Instruction: the past repeated]]></title>
            <link>https://samuelchimaogbonna.medium.com/moral-instruction-the-last-repeated-ff5c811c30ac?source=rss-8124a856b006------2</link>
            <guid isPermaLink="false">https://medium.com/p/ff5c811c30ac</guid>
            <category><![CDATA[nigeria]]></category>
            <category><![CDATA[falz]]></category>
            <category><![CDATA[fela]]></category>
            <category><![CDATA[falz-thebahdguy]]></category>
            <category><![CDATA[music]]></category>
            <dc:creator><![CDATA[Samuel Ogbonna]]></dc:creator>
            <pubDate>Fri, 18 Jan 2019 17:22:50 GMT</pubDate>
            <atom:updated>2020-01-26T20:42:23.552Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/330/1*MguV-4Da_9W8PQQ6R1tfEQ@2x.jpeg" /></figure><p><strong>DISCLAIMER</strong>: This article represents my personal opinion on issues that are so multidimensional, I don’t believe any human being alive can offer a comprehensive and objective opinion but if you like what you’re reading, feel free to like and share this article.</p><p><strong><em>Now</em></strong> down to the business of today, Falz recently released an album titled ‘Moral Instruction’ where in a style reminiscent of afro pop icon Fela, he uses his music to speak about a lot of important topics in today’s Nigerian society ranging from dirty politics to religion, homophobia, nepotism, general hypocrisy, transactional sex and a lot of other things. As expected, the album has created a lot of buzz on social media attracting mixed reviews from both those who wholeheartedly support his music and those who either disagree with his arguments or call him a hypocrite for criticizing a system he is a part of and has benefited from. The most vocal party has been those who have found fault with his stinging criticism of female sex workers and even though that has been the major focus of public discourse, that particular topic never really stood out to me.</p><p>When I first listened to the album, I didn’t have the expected euphoric feeling that comes with listening with good music you can relate to but instead I had an overwhelming negative emotion. It took me a long period of introspection to figure out what that particular feeling was but eventually I realized what the problem was. The problem I had with the album was what it represented when considering its content with respect to Nigerian development as a whole. Falz obviously sees himself as some sort of modern day Fela and it showed in his music as he used snippets of Fela’s music throughout the album and even though these fela choruses and quotes are decades old and address problems which the country faced over 20 years ago, the fact that they are still as relevant today as they were 20 years ago scares me. What does it say about us as a nation if we exist and work for two decades and still can’t solve basic problems? This is the question that was on my mind while I listened to the different songs on the album. In spite of the trillions spent and energy utilized, a country that calls itself the ‘Giant of Africa’ has failed to shed the same shackles that have held it back for decades.</p><p>Corrupt politicians in Nigeria isn’t a new thing, fraudsters, illegal sex trade and blind religion have always been a part of our nation. While I do concede that no country can ever totally solve these problems as they are the result of man’s natural greed, good policy making can always curb these menaces to the minimum possible amount and ensure that through effective enforcement of the law, those who perpetuate these unscrupulous acts are relegated to the minority. The problems can be solved as there are many nations where they have been solved.</p><p>So I won’t spend a lot of time listening to moral instruction because frankly, the album both scares and depresses me and in spite of the fact that falz closes of the album with a statement about how Nigeria is blessed and can still become great if we band together as a people; those words rang hollow because they are the same words we have used to console ourselves for decades and with each passing day, it becomes harder and harder to believe that they can ever come true.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ff5c811c30ac" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[LESSONS FROM THE FUTURE]]></title>
            <link>https://samuelchimaogbonna.medium.com/as-a-young-man-society-and-social-media-always-seems-to-remind-me-that-these-are-the-most-db4589ae5602?source=rss-8124a856b006------2</link>
            <guid isPermaLink="false">https://medium.com/p/db4589ae5602</guid>
            <category><![CDATA[life-lessons]]></category>
            <category><![CDATA[life-goals]]></category>
            <category><![CDATA[wisdom]]></category>
            <category><![CDATA[fulfillment]]></category>
            <category><![CDATA[old-age]]></category>
            <dc:creator><![CDATA[Samuel Ogbonna]]></dc:creator>
            <pubDate>Thu, 20 Sep 2018 07:13:01 GMT</pubDate>
            <atom:updated>2018-09-20T07:13:55.662Z</atom:updated>
            <content:encoded><![CDATA[<p>As a young man, society and social media always seems to remind me that these are the most important years of my life and how it’s time to make the moves that will ensure the financial security of myself and my future family. This gospel is preached on TV, radio, through ‘motivational’ speakers and a host of other media and it seems to be the major message being passed across to young people today in order to ‘empower’ them. I myself generally agree with the core of the message and I have both short and long term plans which I believe will strategically position me for long term financial security. It’s something I believe every young person (male or female) should do but the question that has been on my mind recently is whether this is enough. Financial security is essential for a comfortable life; this is truer than ever as we observe the landscape of the country we call home but I’ve come to believe that it’s not enough for a fulfilled life.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/375/1*OTkeg_Gf0jZ8348khmhDsg@2x.jpeg" /></figure><p>This fact has become more glaring to me as I observe my grandmother who lives in the same house as me. She’s ‘old’ old and as I observe her daily life I’ve begun to question whether the things we prioritize are as important as we make them. At this point in her life she hardly goes out so owning the best clothes is of zero value and she doesn’t really care if the label says ‘Ray Ban’ or ‘Roy Bon’, she doesn’t really care about going to the best restaurants and travelling round the world would probably be more stress than pleasure at this point. Her greatest source of pleasure is time spent with her children and grandchildren and her brightest smiles come when she hears about their progress and success in life. At the end of a long and sometimes hard life, it’s not the physical or material things that give her the most joy but the relationships and memories forms over the course of a lifetime. Yes, she still needs money for the basic necessities such as food, healthcare and shelter but you don’t really need a lot for the basics.</p><p>The point of this post isn’t to demonize prosperity or encourage mediocrity but to remind us that we shouldn’t sacrifice valuable relationships and experiences in the pursuit of fame and wealth. With the peer pressure on social media and the expectations of society, it’s easy to get so desirous of success that we neglect our family and loved ones. But at the end of life when you’re old, weak and wrinkled, it’s the people around you and the memories made over time that will give you a reason to live. So take that vacation with your family, leave work early to watch your daughter’s ballet performance, take the one you love on an impromptu weekend getaway and cherish every moment you have because when all is said and done, people will always be more valuable than money.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=db4589ae5602" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>