<?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 Lukmon AYINLA on Medium]]></title>
        <description><![CDATA[Stories by Lukmon AYINLA on Medium]]></description>
        <link>https://medium.com/@lukmonayinla2?source=rss-d423f2a43a86------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Pt9KIgWpa1a2KuP5cSywWw.jpeg</url>
            <title>Stories by Lukmon AYINLA on Medium</title>
            <link>https://medium.com/@lukmonayinla2?source=rss-d423f2a43a86------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 16:10:12 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@lukmonayinla2/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[The mathematics and Intuitions of Principal Component Analysis (PCA) Using Truncated Singular…]]></title>
            <link>https://medium.com/the-data-league/the-mathematics-and-intuitions-of-principal-component-analysis-pca-using-truncated-singular-b4944e5e95e6?source=rss-d423f2a43a86------2</link>
            <guid isPermaLink="false">https://medium.com/p/b4944e5e95e6</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[statistics]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Lukmon AYINLA]]></dc:creator>
            <pubDate>Sun, 21 Apr 2019 09:51:27 GMT</pubDate>
            <atom:updated>2019-04-26T14:29:53.058Z</atom:updated>
            <content:encoded><![CDATA[<h4>The Mathematics and Intuitions of Principal Component Analysis (PCA) Using Truncated Singular Value Decomposition (SVD)</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/250/1*MIXxXGSw2IoXL6BvMGomcw.jpeg" /></figure><p>As data scientists or Machine learning experts, we are faced with tonnes of columns of data to extract insight from, among these features are redundant ones, in more fancier mathematical term — co-linear features. The numerous columns of features without prior treatment leads to curse of dimensionality which in turn leads to over fitting.</p><p>To ameliorate this curse of dimensionality, principal component analysis (PCA for short) which is one of many ways to address this, is employed using truncated Singular Value Decomposition (SVD).</p><p>Principal Component Analysis starts to make sense when the number of measured variables are more than three (3) where visualization of the cloud of the data point is difficult and it is near impossible to get insight from.</p><p><strong><em>First: Let’s try to grasp the goal of Principal Component Analysis. The following should put in mind:</em></strong></p><ol><li>Is the number of samples (m) much less than the number of measured variables(d) — i.e number of columns in a data frame m&lt;&lt; d</li><li>The goal of PCA is to get a subspace (i.e a lower dimensions) and projecting the cloud of data points to the subspace without losing information embedded in the original data with higher dimensions, so are looking for vector that maximizes the variation of the data.</li></ol><p>Assuming the original data is in d-dimensional space, the goal is to arrive at a new data points in p dimension where p &lt;&lt;&lt; d ( for worst case scenario is p = d). That is the<strong> intuition</strong>.</p><p>The<strong> intuition </strong>can be represented mathematically as thus;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/377/1*OlM9-PDVD1EXzkmccMMs0w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/237/1*gCuPJ8MOMVPr71fnVsIEUQ.jpeg" /><figcaption>2D subspaces in a 3D space.</figcaption></figure><p>I would like to divide this analysis into the following;</p><ol><li>Understanding the concept of projection.</li><li>Principal Component Analysis itself.</li><li>PCA via truncated Singular Value Decomposition.</li></ol><h3><strong><em>Understanding the concept of projection.</em></strong></h3><p>As discussed earlier the main goal of PCA is to arrive at a subspace i.e. lower dimensional space without losing much information.</p><p><strong>Intuition:</strong> Before principal component analysis is carried out on a data set, the data must be centered by subtracting the mean of each measured variables from data points corresponding to the mean axis, so that the summation of all data points is zero.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QoabKkZ8CiEH6X-vWtfW2w.png" /><figcaption>Centered Data</figcaption></figure><p><strong>Mathematics:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/169/1*0analSjeriAZkgaKFiKkLQ.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/133/1*PJy9sCNjyH4YOGVP48mnzw.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/289/1*VzJ6FV7l57NDb7U2-grnbA.gif" /></figure><p>The center shifted data point does not change their positions relative to each other.</p><p><strong>Intuition:</strong> After the data is centered on the origin, we start drawing a random line given that it has to pass through the origin and fitting the line as much as possible on the data points. So, how does PCA know that a line is of the best fit ? This is done by projecting the data points on the line and checking the line that best minimizes the distances between the data points. and the line or the line the best maximizes the distances between the point of the projected data on the line and the origin. This forms an <strong><em>optimization problem.</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OwbejRTgkItFyszB8GDIoA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dn3mXyI0-TpmoDhg1p6_5g.png" /></figure><p><strong>Mathematics: </strong>The length of the projected data points from the origin.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/280/1*ih3PrZG3ysTLtaaj9bDLPA.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/67/1*oHIbIqU-4JO8Lmga7h8MRQ.gif" /></figure><p>As said earlier, this results into an optimization problem considering the fitted line that maximizes the length of the projected data points from the origin.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/185/1*B2mcOloT9DXvoTn4vCQopg.gif" /></figure><p>The lengths of the projections are squared to avoid cancellation of positive values by the negative values.</p><p>Let’s express J(phi) in terms of sample covariance of the data.</p><p><strong>Intuition: </strong>A quick one,<strong> <em>Covariance </em></strong>is the joint variation between two random variables from their corresponding expected value or mean.</p><p><strong>Mathematics:</strong> Where covariance, C is expressed as</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/100/1*_kvFlZxBOSIDqORYpr5k3A.gif" /></figure><p>J(phi) can be written in terms of covariance as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/130/1*T0q8u3pUEiMaLh2CfOWFWA.gif" /></figure><h3><strong><em>Principal Component Analysis itself.</em></strong></h3><p><strong>Intuition:</strong> The purpose of PCA is to find that candidate axis with the maximum of sum of squared distances between the projected point of the fitted line and the origin, J(phi).</p><p><strong>Mathematics:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/142/1*986rNEhV2r4PK2vVQ5hP5Q.gif" /></figure><p>Let’s recall the objective function to be optimized and the span of the candidate axis.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/130/1*T0q8u3pUEiMaLh2CfOWFWA.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/67/1*oHIbIqU-4JO8Lmga7h8MRQ.gif" /></figure><p>Squaring both of the above equation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/67/1*eb1Namw7dPUdiS4gmKoc-w.gif" /></figure><p>Rewriting the above equation which forms the constraint of the maximization of the objective function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/66/1*VRNqZoaKi3A5AeVwhLBqOA.gif" /></figure><p>There is a mathematical trick to achieve this which is known as the <strong><em>Lagrange Multiplier.</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/230/1*ifXP9fMA8P0oplE_OJErYQ.gif" /></figure><p>Recall;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/130/1*T0q8u3pUEiMaLh2CfOWFWA.gif" /></figure><p>So,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/253/1*g3IU5gCF7fWkaH9MwUkEHA.gif" /></figure><p>Finding the derivative of J with respect to phi and lambda respectively</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/196/1*WvL_NqvuMRVwoM5R3-kXQQ.gif" /></figure><p>Equating the derivative of the Lagrange Multiplier to zero forms an Eigen problem.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/253/1*vqCU5K01MOLjHaBPdb_gsw.gif" /></figure><p>So, we are on the search for eigen pairs</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/57/1*zAlR4sGwWbC5jkEjEeJyVA.gif" /></figure><p>We are close to getting the principal components of the subspace of the original data, and there arise an eigen problem where the only know variable is formula above is the covariance matrix. This takes us to the final stage of solving PCA.</p><h3>PCA via truncated Singular Value Decomposition (SVD).</h3><blockquote>Singular value decomposition (SVD) is known as a Swiss Army Knife of Linear Algebra</blockquote><p><strong>Intuition: </strong>And what we want, is to solve the eigen problem that came up in Principal Components Analysis (PCA). There is a fact from the concept of Linear Algebra that every matrix X has a singular value decomposition. This implies that we can factorize or decompose X into three (3) matrices which are:</p><ol><li>Left singular vector, U.</li><li>Diagonal matrix, SIGMA.</li><li>Right singular vector, V.</li></ol><p><strong>Mathematics:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/111/1*mwomQosTUYKML70JN3WnyA.gif" /></figure><p>The dimension of X is (m x d), usually m greater than or equal to d, the dimension of U is (s x m), the dimension of sigma is (s x s) while the dimension of V transpose is (s x d) where;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/111/1*QVi-5mbwN3I6jo0E83tdSg.gif" /></figure><p>The left singular vector, U is orthogonal which implies that:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/75/1*7kw3lMh41g-QQ6_KOVdGpw.gif" /></figure><p>where I is an Identity matrix with dimension (s x s).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/161/1*CFq5F3jDJjVg8EWxv6aQ7A.gif" /></figure><p>sigma is the singular values. where</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/183/1*P8_8PvW6RSs8TpTq7Jwfyw.gif" /></figure><p>Starting with the covariance matrix.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/100/1*_kvFlZxBOSIDqORYpr5k3A.gif" /></figure><p>Recall;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/111/1*mwomQosTUYKML70JN3WnyA.gif" /></figure><p>Substitute X in the covariance matrix.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/237/1*Duw71Gp_xK1fXZ3ahkJXBg.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/227/1*Zoz1isqvzlQK9xZxRoy8QQ.gif" /></figure><p>Recall;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/75/1*7kw3lMh41g-QQ6_KOVdGpw.gif" /></figure><p>We will be left with,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/158/1*bZuU8_Fw-LjB7iWCIq2Jlw.gif" /></figure><p>Rearrange;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/133/1*sf2uXLpcrfFPJA8nIxlwTw.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/134/1*CHMjWenAk0lzaV3ko_T2bw.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/183/1*ua-5ulprSauVLbBrrrvzuA.gif" /></figure><p>At elemental level,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/133/1*PjdySucnAjtO2hDjWNzrCQ.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/179/1*nx8juaEXrsiJ2mqc7MWmKw.gif" /></figure><p>So, let’s start viewing SVD as this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*npUFvCYSUFybNKnLrq72xA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/220/1*kbWFk2cXzxinZoN6MrrF6w.gif" /></figure><p>By convention, the singular values occur in descending order.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/177/1*m4fmzyNClZpCDeNcOlC4Hw.gif" /></figure><p>We can look at X as a running sum of different matrices. So, let’s approximate the original singular value decomposition (SVD) using the first r-term where r &lt; or = s.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/171/1*WX-xsnYEK8rAgA7CtxI9rQ.gif" /></figure><p><strong>In summary:</strong></p><ol><li>Centralized the data X</li><li>Compute the below using r-truncated SVD</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/117/1*4VyoAsDpY5hnP57JKNs8Mw.gif" /></figure><p>3. Let the right singular vector Vr be the new axis that is, the principal component, such that:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/183/1*EeTtf2WiYiiVGMWROJMbMg.gif" /></figure><p>Let’s have a chit chat in comment below if you find anything wrong in this article, or anything you feel is missing, I am willing and ready to learn.</p><p>You can follow me on Medium and also on Twitter<strong> </strong><a href="https://twitter.com/LukmonAyinla2"><strong>@LukmonAyinla2</strong></a> for more update</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b4944e5e95e6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/the-data-league/the-mathematics-and-intuitions-of-principal-component-analysis-pca-using-truncated-singular-b4944e5e95e6">The mathematics and Intuitions of Principal Component Analysis (PCA) Using Truncated Singular…</a> was originally published in <a href="https://medium.com/the-data-league">The Data League</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Journey Down the Gradient Begins with a Learning Rate.]]></title>
            <link>https://medium.datadriveninvestor.com/the-journey-down-the-gradient-begins-with-a-learning-rate-534db29da666?source=rss-d423f2a43a86------2</link>
            <guid isPermaLink="false">https://medium.com/p/534db29da666</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Lukmon AYINLA]]></dc:creator>
            <pubDate>Sun, 09 Dec 2018 14:40:30 GMT</pubDate>
            <atom:updated>2019-04-22T14:25:12.166Z</atom:updated>
            <content:encoded><![CDATA[<p>It all started February 2018, when I quit my job as I want to develop my skills in the area of software development. I discussed this with one of my course mate who have made a mark in this sphere in the person of Mr <a href="https://medium.com/u/db1dfed7826e">Daniel Alienyi</a>, CEO and Lead software developer, TestDriller. Being hungry and thirsty for personal development, I was fortunate to have learnt about Coven Labs’ Data Science and Artificial Intelligence Boot camp with python…Hmm I found that somewhat interesting being that I have prior experience programming in Python at the beginners level. I was like “finally I have found something to do with Python programming language”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/226/1*duG2RJbbq_ExtVfutNSKag.png" /><figcaption>What can I use python programming language for? Data Science and ML</figcaption></figure><p>The Bootcamp was held outside Lagos, Akure for that matter, I didn’t mind the distant, i said unto my self “If I really need the development I crave for I have to travel”…Fast forward to Akure at Curators University, Coven Lab, Data Science and AI Bootcamp (Beginners’ Class). I learnt the rudiment of Data and how to explore and crush data in order to interpret and draw insight from it, it was a whole lot of interesting experience with Mr <a href="https://medium.com/u/14907631c2f1">Innocent Udeogu</a> CTO Ubenwa (One of the trainers) where I got to know about exciting Python libraries which are basic data science tools such as Numpy for numerical computation, Pandas for data wrangling and exploration, Matplotlib for data visualization and sci-kit learn, a machine learning library.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*IkjiGoyj_AlXVFppivBB6w.jpeg" /></figure><p>The beginners’ class was wound up with a team project where we trained a linear regression model to predict credit score for potential bank client seeking loan in order to determine their credit worthiness. Though the beginners’ class was a paid class, thanks to Mr <a href="https://medium.com/u/192ac4b68b25">Olusola Amusan II</a><strong> </strong>who gave all participant the privilege of attending the intermediate class (cohort II) free of all cost…Fast forward to March still at Akure after spending two(2) weeks back home in Lagos, It was time for the intermediate class, this was when I got to understand the practical meaning of descriptive statistical term like mean which the average value representative of the numeric data sets, standard deviation which the root of variance which in turn give information about how data points are dispersed around the mean value that summarizes numeric data. Like the beginner’s class, we were divided into teams where I happened to be the team lead and represented my team in presenting the project on the demo day. My team built a predictive model that predict the price action of EUR/USD currency pair using high, low, open and close price of the historic data of the pair.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*tAPbHmegPfXDjr8a_acgsQ.png" /></figure><p>What a awesome team I worked with. It’s the end of another one week intermediate Boot camp, I have go home, so what next? Do you guys still remember Alienyi Daniel, CEO and Lead software developer of TestDriller?. He called that he finally decided to start the internship program, that I had long for. The internship was on Data Science and Machine Learning. Daniel put up a good curriculum on the basic understanding of data science and Machine Learning. We kick started the training with the introduction to python programming language to coding linear regression algorithm from scratch.</p><p>Another community that made a mark in this journey is the AI Saturday Lagos Community organized by <a href="https://medium.com/u/44e0f445aa49">Tejumade Afonja</a> along side couple of wonderful guys the likes of Femi Azeez, George, Lawrence, Iconic Tola, Oreva and so on. This community of AI learners has done a whole lot of good for us by coding both supervised and unsupervised machine learning algorithm from scratch spanning over a period of 15 weeks, <a href="https://medium.com/u/b128f28c5632">Ibrahim Gana</a> has the gist of the events.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*yQaVoJFHw0qipyELEeGxOQ.jpeg" /></figure><p>In conclusion, the journey has been rewarding so far with the kind of superpower I have in possession and the network of quality friends in AI, they even push me to write my very first Medium post and I’m promising myself to make it a habit of writing about what ever I learnt on Medium. Thanks to those who made this journey of mine rewarding.</p><p>You can follow me on Medium and also on Twitter<strong> </strong><a href="https://twitter.com/LukmonAyinla2"><strong>@LukmonAyinla2</strong></a> for more update</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=534db29da666" width="1" height="1" alt=""><hr><p><a href="https://medium.datadriveninvestor.com/the-journey-down-the-gradient-begins-with-a-learning-rate-534db29da666">The Journey Down the Gradient Begins with a Learning Rate.</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>
    </channel>
</rss>