<?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 Modupeola  Alade on Medium]]></title>
        <description><![CDATA[Stories by Modupeola  Alade on Medium]]></description>
        <link>https://medium.com/@olamiotan?source=rss-fd924111acd------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*s9uBta9lIZdlAloibYi6ag.jpeg</url>
            <title>Stories by Modupeola  Alade on Medium</title>
            <link>https://medium.com/@olamiotan?source=rss-fd924111acd------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 02:15:08 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@olamiotan/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[Regression Analysis]]></title>
            <link>https://medium.com/gitgirl/regression-analysis-a2e2ea2f3fb0?source=rss-fd924111acd------2</link>
            <guid isPermaLink="false">https://medium.com/p/a2e2ea2f3fb0</guid>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[regression-analysis]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[regression]]></category>
            <category><![CDATA[data-analysis]]></category>
            <dc:creator><![CDATA[Modupeola  Alade]]></dc:creator>
            <pubDate>Sat, 29 Jun 2019 23:59:48 GMT</pubDate>
            <atom:updated>2022-09-21T01:26:05.092Z</atom:updated>
            <content:encoded><![CDATA[<h4>Regression analysis is the “go-to method in analytics,” says Tom Redman, author of <em>Data Driven: Profiting from Your Most Important Business Asset.</em></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/1*fc21oMCIgyCDZbGcFtYdVQ.png" /><figcaption>Image from Google search</figcaption></figure><p>Regression analysis is a set of statistical methods used for the estimation of relationships between a dependent variable and one or more independent variables. It is a powerful statistical method that can be utilized to assess the strength of the relationship between variables of interest and for modeling the future relationship between them.</p><p>A dependent variable <strong><em>y</em></strong> is the state, target or final goal we study and try to predict, while the independent variable <strong><em>x</em></strong>, also known as explanatory variable can be seen as the cause of those states.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/304/1*PMcqxPCseFggA4DrjyW7cw.jpeg" /><figcaption>Image from Google search</figcaption></figure><p>The overall idea of regression is to examine two things:</p><ol><li>Does a set of predictor variables do a good job in predicting an outcome (dependent) variable?</li><li>Which variables in particular are significant predictors of the outcome variable, and in what way do they–indicated by the magnitude and sign of the beta estimates–impact the outcome variable?</li></ol><p>These regression estimates are used to explain the relationship between one dependent variable and one or more independent variables. There are various kinds of regression techniques available to make predictions. These are mostly driven by three metrics:</p><ul><li>number of independent variables</li><li>type of dependent variables</li><li>shape of regression line</li></ul><p>Regression analysis could either be a linear regression or non-linear regression.</p><h3><strong>Linear Regression</strong></h3><p>Linear regression is a basic and commonly used type of predictive analysis. Linear regression analysis is based on six fundamental assumptions:</p><ol><li>The dependent and independent variables show a linear relationship between the slope and the intercept.</li><li>The independent variable is not random.</li><li>The value of the residual (error) is zero.</li><li>The value of the residual (error) is constant across all observations.</li><li>The value of the residual (error) is not correlated across all observations.</li><li>The residual (error) values follow the normal distribution.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/253/1*ruYn1Yn0NZPhJXYfJdZfdQ.png" /><figcaption>Image from Google search</figcaption></figure><p>Some type of linear regression are:</p><ul><li><strong>Simple Linear regression</strong> — Is simplest form of the regression equation with one dependent and one independent variable is defined by the equation: <strong><em>Y= a + bX + ϵ</em></strong>, where: <strong><em>Y</em></strong>— dependent variable, <strong><em>X</em></strong>— independent variable, <strong><em>a </em></strong>— intercept, <strong><em>b </em></strong>— slope and <strong><em>ϵ</em></strong> — residual (error).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*yh8b3cxMNSZ8H8SiWHMiNA.png" /><figcaption>Image from Google search</figcaption></figure><ul><li><strong>Multiple Linear regression</strong> — Is essentially similar to the simple linear model, with the exception that 1 dependent variable and multiple independent variables (2 or more) are used. The mathematical equation of multiple linear regression is: <strong><em>Y= a + bX1 + cX2 + dX3 + ϵ </em></strong>, where: <strong><em>y </em></strong>— dependent variable, (<strong><em>X1, X2, X3</em></strong><em> )</em>— independent variables, <strong><em>a </em></strong>— intercept, (<strong><em>b, c, d</em></strong>)<strong><em> </em></strong>— slopes and <strong><em>ϵ </em></strong>— residual (error).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/637/1*V_ltvMD1gB09y6L1Dppdfg.jpeg" /><figcaption>Image from Google search</figcaption></figure><ul><li><strong>Logistic regression</strong> — Is used to find the probability of event being a success or a failure. Here, we have one dependent variable (dichotomous) and one or more independent variables (interval or ratio or dichotomous). We should use logistic regression when the dependent variable is <strong><em>binary</em></strong> (0/1, True/False, Yes/No) in nature. Here the value of <strong><em>y</em></strong><em> </em>ranges from <strong><em>0</em></strong> to <strong><em>1</em></strong>. It is widely used for classification problems and requires large sample sizes.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/318/1*Oi9KKU6Uq_Bj1dy-wUIdTQ.png" /><figcaption>Image from Google search: How logistics regression model works</figcaption></figure><ul><li>If the values of the dependent variable is ordinal, then it is called as <strong>Ordinal Logistic regression.</strong></li><li>If dependent variable is multi class(i.e. nominal) then it is known as <strong>Multinomial Logistic regression</strong>.</li></ul><h3><strong>Non-linear Regression</strong></h3><p>Nonlinear regression is a regression in which the dependent or criterion variables are modeled as a non-linear function of model parameters and one or more independent variables. Nonlinear regression uses nonlinear regression equations, which take the form: <strong><em>Y = f(X,β) + ε</em></strong><br>where: <strong><em>X</em></strong> = a vector of <em>p </em>predictors, <strong><em>β </em></strong>= a vector of <em>k </em>parameters, <strong><em>f(-)</em></strong> = a known regression function and <strong><em>ε</em></strong> = an error term.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*jYXPOW4kg3xqWGDORU65nw.jpeg" /><figcaption>Image from Google search</figcaption></figure><p>There are several common models such as:</p><ul><li>Asymptotic Regression/Growth Model, which is given by:</li></ul><p><strong><em>b1+ b2 * exp (b3 * x)</em></strong></p><ul><li>Logistic Population Growth Model, which is given by:</li></ul><p><strong><em>b1 / (1 + exp (b2 + b3 * x))</em></strong></p><ul><li>Asymptotic Regression/Decay Model, which is given by:</li></ul><p><strong><em>b1- (b2 * (b3 * x))</em></strong></p><p>The reason that these models are called nonlinear regression is because the relationships between the dependent and independent parameters are not linear.</p><p>Other regression analysis are:</p><h4>Polynomial Regression</h4><p>A regression equation is a polynomial regression equation if the power of independent variable is more than 1. Here, the relationship between the independent variable x and the dependent variable <strong><em>y</em></strong> is modeled as an <strong><em>nth</em></strong> degree polynomial in <strong><em>x</em></strong>. The equation below represents a polynomial equation: <strong><em>y= a + bx²</em></strong></p><p>In this regression technique, the best fit line is not a straight line. It is rather a curve that fits into the data points. Examples of such curved fit line are Quadratic/Parabolic Regression(<strong><em>x²</em></strong>) and Cubic Regression(<strong><em>x³</em></strong>).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*FAykvyOnYvchzSgTi3lHtw.jpeg" /><figcaption>Image from Google search</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*pjIp920-MZdS_3fLVhf-Dw.jpeg" /><figcaption>Image from Google search</figcaption></figure><h4>Stepwise Regression</h4><p>This form of regression is used when we deal with multiple independent variables. Step-wise regression basically fits the regression model by adding/dropping co-variate one at a time based on a specified criterion, which involves <em>no</em> human intervention. This feat is achieved by observing statistical values like R-square, t-stats and AIC metric to discern significant variables. The aim of this modeling technique is to maximize the prediction power with minimum number of predictor variables. It is one of the method to handle<a href="https://www.analyticsvidhya.com/blog/2015/07/dimension-reduction-methods/"> </a>higher dimensionality of data set.</p><h4>Ridge Regression</h4><p>Ridge Regression is a technique used when the data suffers from multicollinearity (independent variables are highly correlated). In multicollinearity, even though the least squares estimates are unbiased, their variances are large which deviates the observed value far from the true value. Ridge regression solves the multicollinearity problem through shrinkage parameter <strong><em>λ </em></strong>(lambda).</p><h4>Lasso Regression</h4><p>Lasso (Least Absolute Shrinkage and Selection Operator) also penalizes the absolute size of the regression coefficients. In addition, it is capable of reducing the variability and improving the accuracy of linear regression models. Lasso regression differs from ridge regression in a way that it uses absolute values in the penalty function, instead of squares.</p><h4>ElasticNet Regression</h4><p>ElasticNet is hybrid of Lasso and Ridge Regression techniques. It is trained with regularizer. It is useful when there are multiple features which are correlated.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/290/1*hNvG9HNTIt5bc2H52OWdlg.jpeg" /><figcaption>Image from Google search</figcaption></figure><h3>How to select the right regression model?</h3><p>The simple one is this: If the outcome is continuous, apply linear regression. If it is binary, use logistic regression. However, higher the number of options available at our disposal, more difficult it becomes to choose the right one. Within multiple types of regression models, it is important to choose the best suited technique based on type of independent and dependent variables, dimensionality in the data and other essential characteristics of the data. Below are the key factors that you should practice to select the right regression model:</p><ol><li>Data exploration is an inevitable part of building predictive model. It should be you first step before selecting the right model like identify the relationship and impact of variables</li><li>Model fitting and to compare the goodness of fit for different models, we can analyse different metrics like statistical significance of parameters, R-square, Adjusted r-square, AIC, BIC and error term. This essentially checks for possible bias in your model, by comparing the model with all possible submodels (or a careful selection of them).</li><li>Cross-validation is the best way to evaluate models used for prediction. Here you divide your data set into two group (train and validate). A simple mean squared difference between the observed and predicted values give you a measure for the prediction accuracy.</li><li>If your data set has multiple confounding variables, you should not choose automatic model selection method because you do not want to put these in a model at the same time.</li><li>It will also depend on your objective. It can occur that a less powerful model is easy to implement as compared to a highly statistically significant model.</li><li>Regression regularization methods (Lasso, Ridge and ElasticNet) works well in case of high dimensionality and multicollinearity among the variables in the data set.</li></ol><h3>Why and How <strong>companies use regression analysis</strong></h3><p>Regression analysis is helpful statistical method that can be leveraged across an organization to determine the degree to which particular independent variables are influencing dependent variables .Three major uses for regression analysis are</p><ol><li>Determining the strength of predictors</li><li>Forecasting an effect</li><li>Trend forecasting.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/301/1*BCNPzX09J5q9f1qyvyNlCw.png" /><figcaption>Image from Google search</figcaption></figure><p>Most companies use regression analysis to explain a phenomenon they want to understand (e.g. why did customer service calls drop last month?); predict things about the future (e.g. what will sales look like over the next six months?); or to decide what to do (e.g. should we go with this promotion or a different one?). The possible scenarios for conducting regression analysis to yield valuable, actionable business insights are endless.</p><p>Performing a regression analysis to determine just how confident one should be in an hypothesis allows one to make more informed business decisions, allocate resources more efficiently, and ultimately boost your bottom line.</p><h3>Mistakes to avoid working with regression analysis</h3><p>Tom Redman says there<em> </em>are some things to keep in mind when working with regression analysis to achieve the best possible result:</p><ul><li>Don’t tell your data analyst to go out and figure out what is affecting sales rather identify the factors that you suspect are having an impact and ask your analyst to look at those.</li><li>Also keep in mind whether or not you can do anything about the independent variable you’re considering e.g. you cannot change how much it rains</li><li>Analyses are very sensitive to bad data so be careful about the data you collect and how you collect it, and know whether you can trust it.</li><li>Don’t ignore the error term</li><li>Don’t let data replace your intuition. Ask yourself whether the results fit with your understanding of the situation. And if you see something that doesn’t make sense ask whether the data was right or whether there is indeed a large error term, then look to more experienced managers or other analyses.</li><li>Never forget to look beyond the numbers to what’s happening outside the company. You need to pair any analysis with study of real world. The best scientists and managers look at both.</li></ul><p>Happy Analysis!</p><h3>Reference</h3><ul><li>www.google.com</li></ul><p><em>***Footnote: This study is a part of the final project of my enrollment in a Data Science course organized by GitGirl School.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a2e2ea2f3fb0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/gitgirl/regression-analysis-a2e2ea2f3fb0">Regression Analysis</a> was originally published in <a href="https://medium.com/gitgirl">Gitgirl</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Correlation, Regression and Probability]]></title>
            <link>https://medium.com/gitgirl/correlation-regression-and-probability-f4c40f94e062?source=rss-fd924111acd------2</link>
            <guid isPermaLink="false">https://medium.com/p/f4c40f94e062</guid>
            <category><![CDATA[regression]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[correlation]]></category>
            <category><![CDATA[statistics]]></category>
            <category><![CDATA[probability]]></category>
            <dc:creator><![CDATA[Modupeola  Alade]]></dc:creator>
            <pubDate>Mon, 27 May 2019 18:39:01 GMT</pubDate>
            <atom:updated>2022-09-21T01:29:45.978Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/499/1*X-D8BiL7kZ3N4WBBkr0kaw.jpeg" /></figure><p>Data science is a pretty interesting field, and for the past six months I embarked on this study, it has been exciting and educative. Thanks to a programme I enrolled in at GitGirl School of Data. In the last session, we learned about Introduction to Statistics, but this post is focused on correlation, regression and a little on probability.</p><h3>Correlation</h3><p>Is a statistical technique that can show whether and how strongly pairs of variables are related. There are several different correlation techniques but the most common type is Pearson or product-moment correlation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/646/1*AyUx4b51C61Fd4OXeHAZMg.jpeg" /><figcaption>Image from Google search</figcaption></figure><h4>Correlation Coefficient r:</h4><p>Linear correlation coefficient measures the strength and direction of a linear relationship between two variables. It is sometimes referred to as the Pearson product moment correlation coefficient.</p><p>The value of r is such that <strong><em>-1</em></strong>≤ <strong><em>r</em></strong>≤<strong><em>+1</em></strong>. Instances of r are:</p><ul><li>Positive correlation — If <strong><em>x</em></strong> and <strong><em>y</em></strong> have a strong positive linear correlation, <strong><em>r</em></strong> is close to +1. Positive values indicates a relationship between <em>x</em> and <em>y</em> such that as values for <em>x</em> increases, values for <em>y</em> also increases.</li><li>Negative correlation — If <strong><em>x</em></strong> and <strong><em>y</em></strong> have a strong negative linear correlation, <strong><em>r </em></strong>is close to -1. Negative values indicates a relationship between x and y such that as values x increase, values for y decrease.</li><li>No correlation — If there is no linear correlation or a weak linear correlation, <strong><em>r</em></strong> is close to 0. A value near zero means that there is no relationship between the variables.</li></ul><p>Other instances of <strong><em>r</em></strong>:</p><ul><li>A perfect correlation of +or -1 occurs only when the data points all lie exactly on a straight line. If <strong><em>r </em></strong>= +1 (a <em>perfect positive fit), </em>the slope of the line is positive. If <strong><em>r </em></strong>= -1 (<em>perfect negative fit), </em>the slope of the line is negative.</li><li>A correlation <strong><em>r</em></strong> greater than 0.7 might be considered <em>strong.</em></li><li>A correlation <strong><em>r</em></strong> close to 0.5 might be considered <em>moderate</em>.</li><li>A correlation <strong><em>r</em></strong> close to 0.2 can be considered <em>weak</em>.</li></ul><h4>Coefficient of Determination r²:</h4><p>This is the measure that allows us to determine how certain one can be making predictions from a certain model/graph. The coefficient of determination is the ratio of the explained variation to the total variation i.e.</p><blockquote>r² (or R²) = Explained variation / Total variation</blockquote><p>The coefficient of determination is such that <strong><em>0</em></strong>≤<strong><em>r²</em></strong>≤<strong><em>1</em></strong>, and denotes the strength of the linear association between <strong><em>x</em></strong> and <strong><em>y</em></strong>. The coefficient of determination represents the percent of the data that is the closest to the line of best fit. r² is always between 0 and 100%:</p><p>. 0% indicates that the model explains none of the variability of the data.</p><p>. 100% indicates that the model explains all of the variability of the data and its mean.</p><p>For example, if <strong><em>r </em></strong>= 0.9 , then <strong><em>r²</em></strong> = 0.81, which means that 81% of the total variation in <strong><em>y</em></strong> can be explained by the linear relationship between <strong><em>x</em></strong> and <strong><em>y</em></strong>. The other 19% of the total variation in y remains unexplained.</p><h3>Regression</h3><p>Regression is the process of fitting models to data. It is a technique for determining the statistical relationship between two or more variables where a change in a dependent variable is associated with, or depends on, a change in one or more independent variable. Regression comes in handy mainly in situations where the relationship between two features is not obvious to the naked eyes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*QiU6DcP_r9qWLznMw0-M_Q.png" /><figcaption>Image from Google search</figcaption></figure><h4>Simple Linear Regression:</h4><p>This is a regression that uses only one independent variable and tries to describes the relationship between the dependent and independent variables as a straight line. It is given as:</p><blockquote>y= a + bx</blockquote><p>where <strong><em>y</em></strong> is the dependent variable, <strong><em>x</em></strong> is the independent variable, <strong><em>a</em></strong> is the constant term or intercept , <strong><em>b</em></strong> is the coefficient term or slope of the intercept line.</p><h3>Probability</h3><p>Probability describes a person’s assessment of the likelihood of occurrence of a particular outcome. It has certain familiar properties:</p><blockquote>It is expressed as a number between 0 and 1; a 0 indicates an impossible outcome; a 1 indicates that an outcome is certain to occur.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*HAb0l8d35wl5eq-7Zq5zKw.jpeg" /><figcaption>Image from Google search</figcaption></figure><p>Probabilities between 0 and 1 indicate various degrees of likelihood, ranging from very unlikely to very likely.</p><ul><li>The equal likelihood approach — If there are<strong><em> n</em></strong> mutually exclusive and collectively exhaustive outcomes, and if it is reasonable to consider these outcomes equally likely, then it is also reasonable to set the probability of one of them occurring as <strong><em>1/n</em></strong>. For example, the outcome of a toss of coin is 1/2 for both tails or heads.</li><li>The relative frequency approach — Here, the outcomes of a random process are not regarded as equally likely. For example, to estimate the probability that a 40-year-old man applying for life insurance coverage will die during or survive the next five-year. There are two outcomes, death and survival, but these are not equally likely.</li><li>The judgmental approach — In this approach, a reasonable person’s feel in an assessment of probabilities is meaningful. For example, a weather forecast of the form: “The probability of rain tomorrow is 30%” means what? The best way to interpret this forecast is to regard it as expressing the forecaster’s belief that showers would occur in 30% of all days in the future in which today’s weather configuration will be observed.</li></ul><h4>Probability Distributions</h4><p>A<em> random process</em> can often be described by one or more variables or attributes, and its outcomes by their numerical values or categories. A <em>probability distribution</em> is a list showing the possible values of a random variable (or the possible categories of a random attribute) and the associated probabilities.</p><ul><li>Joint Probability — The probability of independent events A and B occurring</li></ul><p><strong>P(A and B) = P(A) x P(B)</strong></p><ul><li>Union of Events — The probability of either event A or event B occurring</li></ul><p><strong>P(A or B) = P(A) + P(B) — P(A and B)</strong></p><ul><li>Conditional Probability — The probability of event A occurring given that event B has occurred</li></ul><p><strong>P(A|B) = P(A and B) / P(B)</strong> or <strong>P(A|B) = P(B|A) x P(A) / P(B)</strong></p><h4>Sampling with and without replacement</h4><p>Take for example, we have a bag containing 10 balls; 6 red balls and 4 green balls. What is the probability of picking two red balls with replacement? And without replacement?</p><p>a.) Sampling with replacement: From a set of given items, a first item is picked at random, then returned before a selecting the second item.</p><blockquote>P(Red,Red) = P(Red) P(Red|Red) = (6/10)(6/10)= 36/100</blockquote><p>b.) Sampling without replacement: Here, from the set of given items, a first item is selected at random but is not replaced before the second item is selected.</p><blockquote>P(Red,Red) = P(Red) P(Red|Red) = (6/10)(5/9)= 30/100</blockquote><h4>Special Distributions</h4><p>In some cases, however, the distribution can be described by mathematical formula, from which the tabular representation can be obtained. We have Binomial distribution, Hypergeometric distribution and Poission distribution. We also have continuous probability distributions: Exponential and Normal. You can read up on these.</p><h4>Reference</h4><ul><li>www.google.com</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f4c40f94e062" width="1" height="1" alt=""><hr><p><a href="https://medium.com/gitgirl/correlation-regression-and-probability-f4c40f94e062">Correlation, Regression and Probability</a> was originally published in <a href="https://medium.com/gitgirl">Gitgirl</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Lambda functions and Parallel programming]]></title>
            <link>https://medium.com/swlh/lambda-functions-and-parallel-programming-d83db203c483?source=rss-fd924111acd------2</link>
            <guid isPermaLink="false">https://medium.com/p/d83db203c483</guid>
            <dc:creator><![CDATA[Modupeola  Alade]]></dc:creator>
            <pubDate>Fri, 17 May 2019 09:23:39 GMT</pubDate>
            <atom:updated>2022-09-21T01:32:15.506Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/401/1*74r75KSZGaeD2yJ3_bAVWA.png" /><figcaption>Image from Google search</figcaption></figure><h3>Lambda functions</h3><p>When you see or hear the word ‘lambda’, what comes to mind? The 11th letter of the Greek alphabet? Greek numeral representing the value of 30?The unit representation of wavelength?All these are right but in computing, lambda means more.</p><p>Lambda function(or expressions) provides a quick way for declaring small anonymous functions. Anonymous function is a function that is defined without a name. Normal functions are defined using the def keyword followed by the name of the function (e.g. <strong>square</strong><em> — which would square whatever number is supplied as the argument.</em> Lambda functions are can be found in programming languages such as Ruby, Python, Java and JavaScript but our programming language of focus is Python.In Python, anonymous functions are defined using the lambda keyword.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/297/1*UP9ay9oz-29H-f57AJP9gA.jpeg" /><figcaption>Image from Google search</figcaption></figure><p>The basic syntax for lambda functions is in Python</p><pre>lambda arguments: expression</pre><p>An example of lambda function</p><pre>lambda x : x &gt; 0</pre><blockquote>where <strong>lambda</strong> — is a lambda function, <strong>x:</strong> — the parameter name within the function, <strong>x&gt;0</strong> — what to do with the parameter.</blockquote><p>In Python, lambda functions is generally used as an argument to a higher-order function (a function that takes in other functions as arguments). Lambda functions are used along with built-in functions like filter(), map(), apply() , etc.</p><ul><li>The filter() function takes in a function and a sequence(<em>could be sets, lists, tuples,or containers</em>). Each element in the sequence is tested to be true or not and returns in a new sequence which contains items for which the function evaluates to True.</li><li>The map() function takes in a function and a iterable (<em>list, tuples, etc</em>). The function returns a new list which contains items returned by that function for each item of the given iterable.</li><li>The apply() function takes a function and applies it to every single value of the Pandas series.</li></ul><p>During the course of the Gitgirl Data Science programme I enrolled in, a curriculum covering lambdas functions was given and it was required to solve some questions . A record of United States domestic flights from the US Department of Transportation from January 1–15 of 2015 was provided to achieve this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QNEif_Wa9lfuGqEjPxzf0Q.png" /><figcaption>Example of lambda function using the .apply()</figcaption></figure><h3>Parallel Processing</h3><blockquote>Parallel computing is the future of programming and is already paving the way to solving problems that concurrent programming consistently runs into. Although it has its advantages and disadvantages, it is one of the most consistent programming processes in use today.</blockquote><p>Parallel processing is a mode of operation where the task is executed simultaneously in multiple processors in the same computer. According to Wikipedia, parallel computing is closely related to <a href="https://en.wikipedia.org/wiki/Concurrent_computing">concurrent computing</a> — they are frequently used together, and often conflated, though the two are distinct: it is possible to have parallelism without concurrency (such as <a href="https://en.wikipedia.org/wiki/Bit-level_parallelism">bit-level parallelism</a>), and concurrency without parallelism (such as multitasking by <a href="https://en.wikipedia.org/wiki/Time-sharing">time-sharing</a> on a single-core CPU).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/297/1*uGTWsiB04eWX6YttN7IH9w.png" /><figcaption>Image from Google search</figcaption></figure><p>In Python, the multi-processing module is used to run independent parallel processes by using sub-processes (instead of threads). The maximum number of processes you can run at a time is limited by the number of processors in your computer. To know this, the cpu_count() function is used.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/270/1*8JsaCEdC5qb2isyuuZpjPA.png" /><figcaption>Image from Google search</figcaption></figure><p>The advantages of parallel processing(programming) over concurrent programming are:</p><ul><li>it reduces overall processing time, increases both the efficiency and resources used in order to achieve quick results.</li><li>it is more cost efficient because it takes less time to get the same results.</li></ul><p>In parallel processing, there are two types of execution:</p><ol><li>Synchronous — here, the processes are completed in the same order in which it was started.</li><li>Asynchronous — here, the order of the requests can get mixed up but usually gets done faster.</li></ol><p>There are 2 main objects in multiprocessing to implement parallel execution of a function:</p><ol><li>Pool Class</li></ol><p>a. Synchronous execution</p><p>Pool.map() and Pool.starmap()</p><p>Pool.apply()</p><p>b. Asynchronous execution</p><ul><li>Pool.map_async() and Pool.starmap_async()</li><li>Pool.apply_async()</li></ul><p>2. Process Class</p><h4><strong>Parallelizing any function</strong></h4><p>The general way to parallelize any operation is to take a particular function that should be run multiple times and make it run parallelly in different processors. To do this, you initialize a Pool with n number of processors and pass the function you want to parallelize to one of Pools parallization methods.</p><p>To learn more about parallel processing, click these links:</p><ul><li><a href="https://www.machinelearningplus.com/python/parallel-processing-python/">Parallel Processing in Python</a> — A Practical Guide with Examples</li><li><a href="https://computer.howstuffworks.com/parallel-processing.htm">How pararrel processing works</a></li></ul><h4>Reference</h4><ul><li>www.google.com</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d83db203c483" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swlh/lambda-functions-and-parallel-programming-d83db203c483">Lambda functions and Parallel programming</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[Starting a Career in Data Analytics]]></title>
            <link>https://medium.com/gitgirl/starting-a-career-in-data-analytics-3e16e1cc1911?source=rss-fd924111acd------2</link>
            <guid isPermaLink="false">https://medium.com/p/3e16e1cc1911</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[advanced-excel-skills]]></category>
            <category><![CDATA[data]]></category>
            <category><![CDATA[data-analytics]]></category>
            <category><![CDATA[excel]]></category>
            <dc:creator><![CDATA[Modupeola  Alade]]></dc:creator>
            <pubDate>Fri, 29 Mar 2019 03:20:00 GMT</pubDate>
            <atom:updated>2022-09-21T01:36:33.274Z</atom:updated>
            <content:encoded><![CDATA[<h4>“Without big data analytics, companies are blind and deaf, wandering out onto the web like deer on a freeway” — Geoffrey Moore</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/756/1*Y6Lh8vhnLi47FdDYGHuvfw.jpeg" /><figcaption>Image from Google search</figcaption></figure><p>When we think of data analytics, what comes into mind? Detailed and well-constructed data? Data turned information turned insights? If these are your thoughts, you couldn’t be more right. Data Analytics, according to Wikipedia, is a process of inspecting, cleaning, transforming, and modeling data with the goal of discovering useful information, informing conclusions, and supporting decision-making.</p><p>Therefore, a data analyst interprets data and turns it into information which can offer ways to improve a business, thus affecting business decisions. There are various software that are used to achieve data analysis but Microsoft Excel is probably the most well-known tool for working with data. The simplicity of Excel lowers the entrance barrier and allows to quickly get started with data manipulation.</p><p>Excel is one of the top tools for data analysis and the built-in pivot tables are arguably the most popular analytic tool. Learn more on analyzing data using <a href="https://excelexposure.com/excel-video-lesson-intro-to-pivot-tables/">Pivot tables</a>. When the concepts and ideas of pivot tables has been understood, you can move unto the <a href="https://excelexposure.com/advanced-pivot-tables-round-1/">advanced course</a> and <a href="https://excelexposure.com/excel-video-lesson-advanced-pivot-tables-round-2/">lessons</a> on pivot tables.</p><p>At the start of the Code n’ Wine Data Analytics Bootcamp Curriculum organized by GitGirl Initiative which I enrolled in to pursue a career in data analytics, the first module covered how to manipulate data using Excel Spreadsheets. To achieve this, we are given a dataset called <a href="https://www.kaggle.com/c/titanic/data">Titanic</a>. As the name suggests, this <a href="https://www.kaggle.com/c/titanic/data">dataset</a> provides the data on all the passengers who were aboard the RMS Titanic when it sank on 15 April 1912 after colliding with an iceberg in the North Atlantic ocean. It is the most commonly used and referred to data set for beginners in data science. With 891 rows and 12 columns, this data set provides a combination of variables based on personal characteristics such as age, class of ticket and sex, and tests one’s classification skills.</p><p>The objective of the module was to:</p><ol><li>Download the dataset from its source</li><li>Import the dataset containing sheets “<em>Train.csv</em>” and “<em>test.csv</em>” from CSV format into google sheets. To see how this was generated, see <a href="https://support.google.com/docs/answer/40608?co=GENIE.Platform%3DDesktop&amp;hl=en">Import datasets and spreadsheets</a></li><li>Understand the <a href="https://www.kaggle.com/c/titanic/data">data set</a></li><li>Construct a statement on your understanding of the dataset and describe what the data tells you. (What does it mean to you? What are its features? — how many rows and columns?)</li><li>Predict the survival of the passengers aboard <strong><em>RMS Titanic</em></strong></li></ol><h4>Understanding the dataset</h4><p>If you are working with a ‘not too large’ dataset, you can scroll roll and study it. If Not, there are other advanced ways of understanding a dataset. Here, let’s look at some steps we can take when working with a ‘not too large’ dataset.</p><ol><li>Take a detailed good look at the whole dataset.</li><li>After this has been done, take into note the things that are common(i.e. appearing a considerable great amount of time). Such things are used to create insights by carrying out some Excel functions on them.</li><li>Likewise, dissect the dataset preferably column by column and see if any column(s) affects the output of another column(s).</li></ol><h4>My statement</h4><p><em>train.csv</em> contains the data of the passengers of Titanic. It shows data in<strong> 891 </strong>rows<strong> </strong>and <strong>12 </strong>columns. There are <strong>12</strong> columns well represented with details of each passengers such as <strong><em>“PassengerId”, “Survived”, “PClass”, “Name “, “Sex “, “Age”, “SibSp”, “Parch” “Ticket”, “Fare”, “Cabin”</em></strong> and <strong><em>“Embarked”</em></strong><em>.</em> The column <strong><em>Survived</em></strong> shows details in which 1 represent that the passenger survived while O denotes otherwise.</p><p>As for <em>test.csv</em>, it has the same columns as<em> train.csv </em>except the column <strong><em>Survived </em></strong>which is not included. Therefore, we can’t determine their survival status.</p><p>Furthermore information gotten from database:</p><p>The total number of males on the Titanic is <strong>843</strong> while females were <strong>466</strong>. The total number of passengers is <strong>1309</strong>. From the <strong><em>Survived</em></strong> column, survivors is <strong>342</strong> while those who didn’t survive is <strong>549</strong>. Likewise, the number of male survivors is<strong> 109 </strong>while that of female survivors is <strong>233</strong> (which means the number of female survivors is twice and a little more than that of male survivors) The minimum age in the database is <strong>0.17 </strong>which means we have children on board of the Titanic. The maximum age on board is <strong>80</strong>. From the data, I could also deduce that most of the females were their <strong>20</strong>’s while the male were in their late <strong>20</strong>’s, <strong>30</strong>’s or <strong>40</strong>’s. From the name column, I realized that we had passengers with titles such as <em>“Master”</em> who in total are <strong>61</strong>. Unmarried females with the title “<em>Miss”</em> were <strong>260</strong> while the married females with the title <em>“Mrs”</em> were <strong>197</strong>. The men with the title <em>“Mr”</em> were <strong>757</strong> in numbers. Others with our titles were <strong>34</strong> in number. Each passenger details is different from the next and the <strong><em>PassengerId </em></strong>Column is the <em>unique key</em> that each passenger is identified by.</p><p>In data analysis, your intuition is often a great place to start. If you have ever seen the film Titanic, they try to save the women and children first. This would be a good start for one’s predictions.</p><h4>My predictions</h4><blockquote>From the<em> train.csv</em> file, we can deduce that almost 75% of the females survived while 19% of the male passengers survived. From this, we can say that the type of gender is a strong survival factor with females being highly considered than the males. In the <em>test.csv</em> file, a model was created where the <strong><em>Sex </em></strong>column was considered in stating that if gender is female, survival status ‘Yes’ represented by <strong>1 </strong>should be assigned to it in the newly created column <strong><em>Survived</em></strong>. Likewise if the gender is male, <strong>0</strong> should be assigned to the column as the survival status. Therefore in the file <em>test.csv,</em> it was concluded that if you are a female, you survived, while if you a male, you didn’t survive.</blockquote><p>In populating the Survived column, an <strong>IF</strong> statement was used. The <strong>IF</strong> function can perform a logical test and return one value for a <strong>TRUE </strong>result, and another for a <strong>FALSE</strong> result. The syntax is:</p><blockquote>=IF (logical_test, [value_if_true], [value_if_false])</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/239/1*wgQcZdUZ8UgWPzOX-USotw.png" /><figcaption>Flowchart of IF-statement</figcaption></figure><p>In this case, the IF statement was:</p><ul><li>=IF (E2 = “female”, 1, 0) where E2 is an instance of the <strong><em>Sex</em></strong> column</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/559/1*GH9mRXQWtFwX53gSjqtLOQ.png" /><figcaption>Bar chart visualization for the number of survivors against non-survivors</figcaption></figure><p>Excel is a good way to start out a career in data analysis, so if you are seeking on venturing into this career path, start with it. Take courses and watch videos on Advanced Excel skills and you are one step away from achieving your goal.</p><h4>Reference</h4><ul><li>www.google.com</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3e16e1cc1911" width="1" height="1" alt=""><hr><p><a href="https://medium.com/gitgirl/starting-a-career-in-data-analytics-3e16e1cc1911">Starting a Career in Data Analytics</a> was originally published in <a href="https://medium.com/gitgirl">Gitgirl</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Working with SQLite: Sample Chinook Data]]></title>
            <link>https://medium.com/gitgirl/working-with-sqlite-sample-chinook-data-8c923cefbc16?source=rss-fd924111acd------2</link>
            <guid isPermaLink="false">https://medium.com/p/8c923cefbc16</guid>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[data]]></category>
            <category><![CDATA[sqlite]]></category>
            <dc:creator><![CDATA[Modupeola  Alade]]></dc:creator>
            <pubDate>Thu, 28 Mar 2019 16:04:20 GMT</pubDate>
            <atom:updated>2022-09-21T01:10:25.856Z</atom:updated>
            <content:encoded><![CDATA[<h4>“The goal is to turn data into information, and information into insight” — Carly Fiorina (former president of Hewlett-Packard Co.)</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/647/1*3jBwjD_tHhPzbsohtQxKgA.jpeg" /></figure><p>With a desire to start a career in Data Science, I found an opportunity few months ago to enroll in an online course organized by <em>GitGirl</em> school. In the course of study, it was expected of students of the programme to work with SQL queries in its Module 5 of the Data Analytics Curriculum.</p><p>Most relational database management system (<em>RDBMS</em>) such as <em>MySQL</em>, <em>PostgreSQL</em>, <em>Microsoft SQL</em>, etc requires a separate server to run a database but not <em>SQLite</em>, its database is integrated with the application that access the database and does not need a server to run. Just as the name SQLite, this software means light weight in terms of setup, database administration and required resource.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/604/1*Ew3oPDA7XZuB38-3WYlh5w.jpeg" /><figcaption>RDBMS Client-Server Architecture</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/407/1*Nus3zpMLMhI9TKZ324e4aw.jpeg" /><figcaption>Serverless Architecture</figcaption></figure><p>Owing to my previous experience of writing SQL queries (using Microsoft SQL though), I did not find SQLite hard to work it; it was pretty easy actually. To complete certain units of the Module, it was required to download a sample database called Chinook, load it up on the database software (I used DB Browser for SQLite) and run every necessary query required; which were all SELECT statements.</p><h4>CHINOOK Database</h4><p>There are 11 tables in the Chinook sample database namely: <em>employees, customers, invoice, invoice_items, artists, albums, media_types, genres, tracks, playlist</em>s and <em>playlist_track</em>. View the picture of Chinook database diagram to know more about it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*HExYQdTRRz2qHAR7unvYoQ.jpeg" /><figcaption>Sample Chinook Database Diagram</figcaption></figure><h4>SELECT statements</h4><p>A <em>SELECT</em> statement retrieves zero or more rows from one or more database tables or views. It is the most commonly used data query language command. A basic <em>SELECT</em> statement syntax looks like this:</p><blockquote>SELECT<em> * (or column1, column2, …)</em></blockquote><blockquote>FROM <em>table_name (or view_name);</em></blockquote><p>The <em>SELECT</em> statement has many optional clauses:</p><p><strong>.</strong> <em>WHERE</em> — specifies which row(s) to be retrieved.</p><p><strong>.</strong> <em>GROUP BY</em> — groups rows sharing a property so that an aggregate function can be applied to each group.</p><p><strong>. </strong><em>HAVING </em>— selects among the groups defined by the GROUP BY clause.</p><p><strong>. </strong><em>ORDER BY</em> — specifies an order in which to return the rows; either ascending or descending.</p><p><strong>.</strong> <em>AS</em> — provides an alias which can be used to temporarily rename tables or columns.</p><p>Some other clauses used to filter data were considered in the SELECT statement such as:</p><p><strong>.</strong> LIMIT — restricts the number of rows to be returned to the amount specified.</p><p><strong>.</strong> BETWEEN — tests whether a value is in a range of values.</p><p><strong>.</strong> IN — checks if a value matches any value in a list of values.</p><p><strong>.</strong> LIKE — queries data based on pattern matching using wildcard characters: percent sign(%) and underscore(_).</p><p><strong>.</strong> DISTINCT — returns only the unique rows from a table.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BhUiIwuLEuHKGtQLUpLqXA.png" /><figcaption>Image from Google search</figcaption></figure><h4>SQL Joins</h4><p>A JOIN clause is used to combine rows from two or more tables, based on a common column. The condition you want to be met would determine which of the join types you would use. There are four basic types of SQL joins: inner, left, right, and full.</p><p><strong><em>.</em></strong><em> INNER JOIN</em> — Returns records that have matching values in both tables.</p><p><strong>.</strong> <em>LEFT (OUTER) JOIN</em> — Returns all records from the left table, and the matched records from the right table.</p><p><strong>.</strong> <em>RIGHT (OUTER) JOIN </em>— Returns all records from the right table, and the matched records from the left table.</p><p><strong>.</strong> <em>FULL (OUTER) JOIN </em>— Returns all records when there is a match in either the left or right table.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/528/1*WyRshnsIq1gR3jEzxra0Rw.jpeg" /><figcaption>SQL Joins Image from Google search</figcaption></figure><p>Other join functions are:</p><p><strong>.</strong> <em>CROSS JOIN</em> — produces a result set which is the number of rows in the first table multiplied by the number of rows in the second table if now <em>WHERE </em>clause is used.</p><p><strong>.</strong> <em>SELF JOIN </em>— joins a table to itself to create a result set that joins rows with other rows within the same table.</p><h4>SQL Aggregations</h4><p>An aggregate function allows one to perform a calculation on set of values to return a single scalar value. We often use aggregate functions with the <em>GROUP BY</em> and <em>HAVING</em> clauses of the <em>SELECT</em> statement. The commonly used ones are:</p><p><strong>.</strong> <em>AVG </em>— calculates the average of a set of values.</p><p><strong><em>.</em></strong><em> COUNT </em>— counts rows in a specified table or row.</p><p><strong>.</strong> <em>MIN </em>— gets the minimum value in a set of values.</p><p><strong><em>.</em></strong><em>MAX </em>— gets the maximum value in a set of values.</p><p><strong>.</strong> <em>SUM</em> — calculates the sum of values.</p><p>We also used modifier (<em>DISTINCT</em> or <em>ALL</em>) when using aggregate functions. <em>DISTINCT</em> modifier when used, ignores duplicate values and considers only unique values. <em>ALL</em> modifier which is the default if one does not specify, uses all values for calculation.</p><p>All these SQL semantics was learnt duringthe course of study. Here is an example of a query that returns the artist<strong> </strong>name and total track count of the top 10 rock bands from dataset supplied.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/825/1*bOu_Jlbarer8G4BVMKX8mw.png" /><figcaption>SELECT statement uses COUNT, INNER JOIN, WHERE, GROUP BY, ORDER BY and LIMIT</figcaption></figure><p>Here is an excel output with a bar chart visualization of the total spending (revenue) for each country generated from the dataset given.</p><p>NB: This was done with the aid of pivot tables and charts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/823/1*jGSWD87Aqwz9krJsHS3ryA.png" /><figcaption>Excel output and bar chart visualization</figcaption></figure><blockquote>The total spending (revenue) for all the 24 countries given is 2,328.60. USA has the highest revenue of 523.06 which is approximately 22.5% of the total spending. Followed is Canada with 303.96 (approximately 13.1%). France is the third highest with revenue of 195.10 (equivalent to approximately 8.4%) and closely followed is Brazil with 190.10. Hungary and Ireland share the same revenue of 45.62 (approx. 2%) while the least 7 spending countries (Argentina, Australia, Belgium, Denmark, Italy, Poland and Spain) spent the same revenue of 37.62 (approx. 1.6%).</blockquote><p>To view more examples of queries generated from the Chinook database, visit my <a href="https://github.com/olamiotan/PythonStarter">Github </a>page and view the links with the extensions .sql</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8c923cefbc16" width="1" height="1" alt=""><hr><p><a href="https://medium.com/gitgirl/working-with-sqlite-sample-chinook-data-8c923cefbc16">Working with SQLite: Sample Chinook Data</a> was originally published in <a href="https://medium.com/gitgirl">Gitgirl</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>