<?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 Oluwanifemi Bamgbose on Medium]]></title>
        <description><![CDATA[Stories by Oluwanifemi Bamgbose on Medium]]></description>
        <link>https://medium.com/@nifemibam?source=rss-ad3f95fbcdc7------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*Wi2ZbB5eRgSo-gDgy-XgfQ.jpeg</url>
            <title>Stories by Oluwanifemi Bamgbose on Medium</title>
            <link>https://medium.com/@nifemibam?source=rss-ad3f95fbcdc7------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 06:59:32 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@nifemibam/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[Making Machine Learning Less Fancy: Gradient Descent]]></title>
            <link>https://nifemibam.medium.com/making-machine-learning-less-fancy-gradient-descent-105b0c5a3044?source=rss-ad3f95fbcdc7------2</link>
            <guid isPermaLink="false">https://medium.com/p/105b0c5a3044</guid>
            <category><![CDATA[linear-regression]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[gradient-descent]]></category>
            <dc:creator><![CDATA[Oluwanifemi Bamgbose]]></dc:creator>
            <pubDate>Mon, 15 Feb 2021 10:03:28 GMT</pubDate>
            <atom:updated>2021-02-15T10:14:28.178Z</atom:updated>
            <content:encoded><![CDATA[<p>Machine learning, is primarily concerned with minimizing the error of a model or making the most accurate predictions possible.</p><p>Gradient Descent is one of the most important machine learning algorithms and it finds uses in Linear Regression and Neural Networks.</p><p>Gradient Descent is used to reduce a cost(or loss) function. It does this by iteratively tweaking the parameters( or coefficients) of a given function to minimize it to its local minima.</p><p>To properly explain gradient descent, I’ll give a brief explanation of some fundamental concepts. I’ll be explaining gradient descent with regards Linear Regression.</p><p><strong>Linear Regression</strong></p><p>Linear Regression models the relationship between an independent variable (CAUSE; (x)such as size of a house in metres) and a dependent variable(EFFECT; (y)such as price of the house in dollars) . For every value of y , there exists a value of x. These are plotted as shown below.</p><figure><img alt="Independent variables against dependent variable, with data points plotted" src="https://cdn-images-1.medium.com/max/1024/1*F4JzgiTIUfFePLBj4A_JPw.jpeg" /><figcaption><a href="https://www.youtube.com/watch?v=zPG4NjIkCjc">Source</a></figcaption></figure><p>Linear regression models this relationship by fitting a linear equation(or a straight line) to the available(observed) data .</p><p>This linear equation is represented as ;</p><blockquote>y’ = <strong>m</strong>*x + <strong>c</strong></blockquote><p>Where y’ represents a predicted value of the independent variable, m represents the slope ( or in more descriptive terms, “how the line tilts”) and c represents the intercept ( where the line cuts the y axis i.e the value of y when x = 0).</p><p>Linear regression finds these two coefficients which correspond to a line. This line is then used to <strong>predict</strong> new values of the dependent variable for a corresponding independent variable ( by checking the value of the y axis for a corresponding value of the x axis on the line).</p><p><strong>But how is the line drawn in the first place ?</strong></p><p>The line is first drawn with random values of those coefficients(m and c). And then it is updated based on how correct or wrong the line is in predicting values of the current (available/observed) data i.e how do the values of <strong>y’ predicted</strong> when a value of <strong>x</strong> is plugged into the linear equation above (with the coefficients plugged in) compare to the actual(observed/available) values of <strong>y</strong> for those same values of <strong>x.</strong></p><p><strong>How does linear regression know how correct or wrong the line is ?</strong></p><p>This is where the error/cost(or loss) function comes in. The cost function is a representation of how well(or badly) the model is predicting ‘y’ based on its current coefficients. It measures the difference between the actual output “y” and predicted output “ y’ ” from the model. There are many different types of cost functions used in Machine Learning. One of the most common is Mean Squared Error</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/567/1*lT8Ddminmd1dlNEvtnRXIg.png" /><figcaption><a href="https://www.mygreatlearning.com/blog/mean-square-error-explained/">Source</a></figcaption></figure><p>Mean squared error is calculated as the name implies, by taking the mean of the square of the difference between the actual and predicted values for each training example ( a training example can be something like a single record of a house’s size in metres(x) and its price (y)). The formula is shown below;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/638/1*7OSWyPTpvPJ-blIW5ULVkQ.gif" /><figcaption><a href="https://www.freecodecamp.org/news/machine-learning-mean-squared-error-regression-line-c7dde9a26b93/">Source</a></figcaption></figure><p>Where n represents number of training examples, while y represents the actual values and y’ represents the predicted values ( which are gotten from the linear equation ..<strong> y’= mx + b</strong> .. . Keeping in mind ‘m’ and ‘b’ are coefficients of the particular line that the loss function is being calculated for). The cost function can be represented as J(m,b) where m and b are the parameters of the linear equation.</p><p><strong>We know how badly the model is performing , now what ?</strong></p><p>Now THIS is where gradient descent comes in. As defined earlier , gradient descent minimizes this cost function. <strong>Why ?</strong> Because when the value of the cost function is as low as possible(at its minimum) , the model(i.e line) is predicting values as accurately as possible.</p><p><strong>How then does Gradient Descent Work?</strong></p><p>The graph below shows the Cost function(J) against the parameter ‘m’ which is the slope of the line (using only the slope in this case to make it as simple as possible) represented as w(weight).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HrFZV7pKPcc5dzLaWvngtQ.png" /><figcaption><a href="https://rasbt.github.io/mlxtend/user_guide/general_concepts/gradient-optimization/">Source</a></figcaption></figure><p>Gradient descent is an iterative(done repeatedly with a small change learnt from the previous execution towards an end goal) process that starts off by randomly initializing a value of the parameters(i.e the initial slope and intercept that correspond to the random initial line drawn) , then taking steps in the direction of the minima. This is done by taking steps in proportion to the derivative of the line at this initial point. The derivative here is the most important part, it refers to the slope of the function at a given point. Calculating this slope enables us to know the direction(sign) and in which to change the coefficients(slope and intercept) to lower the cost function. By this means , gradient descent provides us with new values for the function coefficients(slope and intercept) that reduce the cost function.</p><p>The gradient of the point in question is the <a href="https://www.mathsisfun.com/calculus/derivatives-partial.html">partial derivative</a> of the cost function with respect to the parameter being updated.</p><p>This process(for this case of linear regression with one variable) is represented in the formula shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/885/1*NAkHNeEFHjY7UlCqALoVWA.png" /></figure><p>Where {∂/∂m J(m,c) and ∂/∂c J(m,c)}are the partial derivatives of the cost function with respect to the coefficients of the linear equation ( could also be called features or weight and bias ), ‘:=’ is the assignment or “update” operator and “ alpha 𝛼” is the learning rate.</p><p>The process is to be repeated simultaneously( i.e values should be calculated updated at the same time) until convergence ( the point where Gradient Descent makes VERY small changes parameters of the function meaning it is very near the minima if not on it).</p><p>The learning rate is one of the most important parts of gradient descent, because it determines how large the “learning steps” to be taken are in the direction of the minima as shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t56DLfRPPWnB81ANQh7DZw.png" /><figcaption><a href="https://towardsdatascience.com/an-introduction-to-gradient-descent-c9cca5739307">Source</a></figcaption></figure><p>It is therefore important to choose an appropriate learning rate , because a very high learning rate can result in gradient descent missing the minima and never converging , and a very low learning rate can result in taking too much time to reach convergence as shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hoXBwwA0RcVE07zeV2pHOw.png" /><figcaption><a href="https://towardsdatascience.com/gradient-descent-in-a-nutshell-eaf8c18212f0">Source</a></figcaption></figure><p><strong>In Summary,</strong></p><p>Gradient Descent is an iterative algorithm that is used to minimize a cost function. This process finds use in many Machine Learning problems and is very much worth further study</p><p><strong>Some Notes to look into :</strong></p><p>There are Different types of Gradient Descent based on the amount of data used when computing the gradients for each learning learning step;</p><ol><li>Batch Gradient Descent</li><li>Stochastic Gradient Descent</li><li>Mini-Batch Gradient Descent</li></ol><p>Also, note that to keep this post is kept in its most basic and understandable form , Gradient Descent could also have multiple features .</p><p>Another thing to look into is Normalisation and how large ranges of values for features ( such as the size of the house in <strong>hundreds</strong> of square metres , and the price of the house in <strong>millions</strong> of dollars can affect gradient descent) and how Normalisation helps solve this problem.</p><p>And also look into Plotting the cost against time to observe the learning rate</p><p><strong>References</strong></p><ol><li><a href="https://www.coursera.org/learn/machine-learning">Andrew Ng Machine Learning Course on Coursera</a></li><li><a href="https://machinelearningmedium.com/2017/08/15/gradient-descent/">Machine Learning Medium — Gradient Descent</a></li><li><a href="https://www.kdnuggets.com/2020/05/5-concepts-gradient-descent-cost-function.html">KD-nuggets Gradient Descent Concepts</a></li><li><a href="https://www.kdnuggets.com/2017/04/simple-understand-gradient-descent-algorithm.html">KD-nuggets- Simple Gradient Descent</a></li><li><a href="https://www.youtube.com/watch?v=sDv4f4s2SB8&amp;t=949s">Youtube — Gradient Descent</a></li><li><a href="https://arshren.medium.com/gradient-descent-5a13f385d403">Ashren Medium — Gradient Descent</a></li><li><a href="https://machinelearningmastery.com/linear-regression-for-machine-learning/">Machine Learning Mastery — Linear Regression for Machine Learning</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=105b0c5a3044" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[2019: A Review]]></title>
            <link>https://nifemibam.medium.com/2019-a-review-eed92302e0f0?source=rss-ad3f95fbcdc7------2</link>
            <guid isPermaLink="false">https://medium.com/p/eed92302e0f0</guid>
            <category><![CDATA[year-in-review]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Oluwanifemi Bamgbose]]></dc:creator>
            <pubDate>Sat, 04 Jan 2020 14:22:06 GMT</pubDate>
            <atom:updated>2020-01-04T14:22:06.396Z</atom:updated>
            <content:encoded><![CDATA[<p>2019 was one of my most eventful years yet. It was my first year learning code (a result of a horrible career fair i attended lol). Started learning JavaScript from Colt Steele’s NodeJS Web Developer Course on Udemy, arguably one of the most popular Web Development courses ever.</p><p>For the First Six months of the year , I underwent my compulsory Industrial Attachment at Airtel Nigeria( the second largest telco in Nigeria) which was when my friends started calling me banana boy lmao. I learnt a whole lot and i was lucky to have people who cared about my development and that was how i got to see how a lot of the things i had started learning regarding web development worked in the real world, *did i mention i worked in the IT and Networks departments* , This was also when i picked up Python and Django and started working on mini projects and writing little scripts and got introduced to the world of data analysis and visualisation. I met some amazing people along the way and i’m immensely grateful for that experience.</p><p>Oh yeah, last year was also when i joined Celebration Church , amazing church, amazing sermons, amazing family. I experienced Progress and Joy in Faith.</p><p>After my IT , i had about 2 months of holidays, went on a few dates, had some fun, won a case competition , and joined the Hotels.ng Machine Learning Track of the internship , and it was going pretty well too, till i got back to school in september but i had to stop because CSIS decided it wasn’t for me*iykyk*.</p><p>Although i did complete an Image Classifier and i started to fall in love with Machine Learning, i continued to learn about ML from different sources, a bit haphazardly , learnt to use IBM Watson and completed Chapters 1 and 2 of my final year project (an IoT based Energy Management System which i’ll write another post on later) , had my IBM certification exams postponed, completed some awesome virtual internships on InsideSherpa , which i found out about by following MomentswithBren on twitter, and started learning Data Structure and Algorithms after multiple failed applications to some Abroad based Investment Banks.</p><p>AS the year came to a close , i built up speed and committed to productivity, learnt a lot for my project and started building it, fully geared up for the year ahead, I’m writing this post full of productive determination and working hard at achieving my goals .</p><p>Land, Ho!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eed92302e0f0" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>