<?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 Ahmad Yusuf Albadri on Medium]]></title>
        <description><![CDATA[Stories by Ahmad Yusuf Albadri on Medium]]></description>
        <link>https://medium.com/@ahmadyusufalbadri?source=rss-3954ba6af883------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*nAbUje4cPOvsA6NoIgBZMw.jpeg</url>
            <title>Stories by Ahmad Yusuf Albadri on Medium</title>
            <link>https://medium.com/@ahmadyusufalbadri?source=rss-3954ba6af883------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 19:55:17 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ahmadyusufalbadri/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[Relearn the Foundation — Simple Linear Regression]]></title>
            <link>https://medium.com/@ahmadyusufalbadri/relearn-the-foundation-simple-linear-regression-9b61e2de0f9d?source=rss-3954ba6af883------2</link>
            <guid isPermaLink="false">https://medium.com/p/9b61e2de0f9d</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[regression]]></category>
            <category><![CDATA[statistics]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Ahmad Yusuf Albadri]]></dc:creator>
            <pubDate>Sat, 24 May 2025 10:30:48 GMT</pubDate>
            <atom:updated>2025-05-24T11:11:28.897Z</atom:updated>
            <content:encoded><![CDATA[<h3>Relearn the Foundation — Simple Linear Regression</h3><h4>The foundation of many fancy and complex methods.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qn40VOUKzqwI-XVH" /><figcaption>Photo by <a href="https://unsplash.com/@reubenteo?utm_source=medium&amp;utm_medium=referral">Reuben Teo</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Linear regression is a simple yet powerful method for predicting a quantitative response. It is a good jumping-off point for learning many other fancy and complex methods, such as neural networks.</p><p>The simplest form of a linear regression model is a simple linear regression model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/288/1*Imoy1imK48Zk7xskvL99yQ.png" /><figcaption>Eq. 1. A Mathematical Representation of Simple Linear Regression for the Population</figcaption></figure><p>It only contains a single predictor variable. In this form, we can see that we assume the relationship between X and Y is (approximately) linear. If not, we might still be able to use simple linear regression by transforming the X or the Y so that the relationship between the two is approximately linear.</p><p>The simple linear regression model in Eq. 1 is represented for the population. So the betas, i.e., \beta_0 and \beta_1, are called the regression coefficient, which belongs to the population. While the error (\epsilon) is simply the error (irreducible error) of the model.</p><p>The estimate for \beta_0 and \beta_1 can be achieved by minimizing the residual sum of squares (RSS), which is commonly known as OLS (Ordinary Least Squares).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/365/1*q4D9uzERK3NPKfW1aKzgpQ.png" /><figcaption>Eq. 2. RSS Definition</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*qRFSZrU4pjdS1-FpTTE68g.png" /><figcaption>Eq. 3. RSS Equivalent Representation</figcaption></figure><p>The sample error term (e) catches all that we miss from a simple model, such as when the true relationship is probably not linear, the existence of other variables that cause variation in Y (omitted variable), and measurement error.</p><h3>How exactly do we estimate \beta_0 and \beta_1 using OLS?</h3><p>Simply by utilizing basic calculus, the first derivative, because we want to find the estimate of \beta_0 and \beta_1 that minimizes the RSS.</p><p>Let’s get our hands dirty, we get the following solution:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/772/1*RJPSkYpOCaZjpp-RWmJ4CQ.png" /><figcaption>Fig. 1. Analytical Solution Part 1</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QfZ60egLTxnyvS5OwQ3PHw.png" /><figcaption>Fig. 2. Analytical Solution Part 2</figcaption></figure><p>From the analytical solutions above, we get the estimators for \beta_0 and \beta_1 as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/447/1*oTNkH1LDlpI4LO-rc0JLxg.png" /><figcaption>Eq. 4. OLS Estimators for \beta_0 and \beta_1</figcaption></figure><p>We can use Eq. 4 to estimate a simple linear regression model&#39;s \beta_0 and \beta_1.</p><p>Let’s try it in action!</p><h3>Simple Linear Regression in Action</h3><p>First things first, let’s try to make a class for our simple linear regression estimator above in Python. I created the class as follows:</p><pre># Create a class for a simple linear regression<br>class simple_linear_regression():<br>    def __init__(self, y, x):<br>        self.y = y<br>        self.x = x<br>    <br>    def estimate_beta(self):<br>        y_mean = self.y.mean()<br>        x_mean = self.x.mean()<br>        self.beta1 = np.sum((self.x - x_mean) * (self.y - y_mean)) / np.sum((self.x - x_mean)**2)<br>        self.beta0 = y_mean - (self.beta1 * x_mean)<br>        return self.beta0, self.beta1</pre><p>Feel free to adjust it if you find a more efficient way to translate the estimators that we got in Eq. 4 in a Python class.</p><p>For the example case, let’s say we have advertising data for TV and sales of a product generated in 200 different regions. We save it into a variable called <em>advertising_df</em>. We wish to use the TV advertising spend to predict sales.</p><pre># See the data<br>display(advertising_df.sample(5))<br>print(advertising_df.info())</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/523/1*mPTtqnoKqKwtpFXqN7cJnQ.png" /><figcaption>Fig. 3. A Sneak Peak Into the advertising_df</figcaption></figure><p>Then, let’s look at a scatterplot on how the two variables relate to one another.</p><pre># Create a scatter plot<br>advertising_df.plot.scatter(x=&#39;TV&#39;, y=&#39;sales&#39;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/563/1*tqVUXzlzsjpj3TFb09nCpQ.png" /><figcaption>Fig. 4. Scatter Plot Between TV and Sales</figcaption></figure><p>The relationship between TV advertising spent and sales is approximately (not exactly) linear, with increasing variance of sales as the TV advertising spent increases. Then, let’s try to estimate the \beta_0 and \beta_1 from the simple linear regression model.</p><pre># Create the object<br>reg_simple = simple_linear_regression(advertising_df[&#39;sales&#39;].values, advertising_df[&#39;TV&#39;].values)<br><br># Estimate the coefficients<br>reg_simple.estimate_beta()<br>print(reg_simple.beta0, reg_simple.beta1)<br><br># Create a chart to visualize the results<br>advertising_df[&#39;y_hat&#39;] = reg_simple.beta0 + (reg_simple.beta1 * advertising_df[&#39;TV&#39;])<br>advertising_df.plot.scatter(x=&#39;TV&#39;, y=&#39;sales&#39;)<br>plt.plot(advertising_df[&#39;TV&#39;], advertising_df[&#39;y_hat&#39;], color=&#39;r&#39;)<br>plt.show()</pre><p>Output for the estimated \beta_0 and \beta_1:</p><pre>(np.float64(7.0325935491276965), np.float64(0.047536640433019736))</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/563/1*fA4GTw4Dl08uOPJgUdeIFw.png" /><figcaption>Fig. 5. The Estimated Regression Line</figcaption></figure><p>We can see that our estimated simple linear regression line is quite good at following the pattern of our data. The estimated \beta_0 and \beta_1 are 7.033 and 0.048.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/283/1*qSdESscQJ9tZF8HP_DAEKg.png" /><figcaption>Eq. 5. Least Squares Line (Estimated Simple Linear Regression Model)</figcaption></figure><p>Based on the estimated \beta_1, an additional $1,000 spent on TV advertising is associated with selling approximately 48 additional units of the product.</p><p>Simple linear regression — simple and yet powerful, as long as the relationships between X and Y are approximately linear.</p><p>Note that the estimated \beta_0 and \beta_1 are simply the \hat{\beta_0} and \hat{\beta_1} respectively.</p><p>Thanks for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9b61e2de0f9d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[An Introduction to Statistical Learning — Introduction]]></title>
            <link>https://medium.com/pythons-gurus/an-introduction-to-statistical-learning-introduction-a5f706f88bd9?source=rss-3954ba6af883------2</link>
            <guid isPermaLink="false">https://medium.com/p/a5f706f88bd9</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[unsupervised-learning]]></category>
            <category><![CDATA[supervised-learning]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Ahmad Yusuf Albadri]]></dc:creator>
            <pubDate>Wed, 19 Jun 2024 06:31:44 GMT</pubDate>
            <atom:updated>2024-06-19T06:35:08.138Z</atom:updated>
            <content:encoded><![CDATA[<h3>An Introduction to Statistical Learning — Introduction</h3><h4>Day 1 notes from “An Introduction to Statistical Learning: with Applications in Python by Hastie et. al.” as part of my Data Science learning documentation.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*hTrgCT0rAeCBuQf2" /><figcaption>Photo by <a href="https://unsplash.com/@artturijalli?utm_source=medium&amp;utm_medium=referral">Artturi Jalli</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><blockquote>Here, I’m combining my prior knowledge in Python and machine learning to help visualize and make the narrative to be applicable in code.</blockquote><h4>Machine (statistical) learning (ML) refers to a vast set of tools for understanding data.</h4><p>It is mainly categorized into:</p><ul><li><strong>Supervised learning</strong>: building a (statistical) model for predicting or estimating an output based on one or more inputs.</li><li><strong>Unsupervised learning</strong>: building a system (model or algorithm) to learn relationships and structure from data thus there are inputs but<br>no supervising output like in the supervised learning.</li></ul><p>The difference between supervised and unsupervised learning lies in the <strong>availability of output data </strong>(synonym: dependent variable, target variable, or outcome which is symbolized as “y”).</p><p>Let’s prepare our Python code first by importing the essential libraries.</p><pre># Import library<br>import pandas as pd<br>import numpy as np<br>import matplotlib.pyplot as plt<br>import seaborn as sns<br>from ISLP import load_data # ISLP provided by the author of the book</pre><p>Here are some examples of cases in machine learning:</p><h3>1. Wage Data: Supervised Learning — Regression</h3><p>Let’s import the data.</p><pre># Import wage data from ISLP<br>df_wage = load_data(&#39;Wage&#39;)<br>df_wage</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XpCap-8ZZouXkSyhIsEA-Q.png" /><figcaption>Wage Data. Image by Author.</figcaption></figure><p>This data can be used to examine factors related to wages for a group of men from the Atlantic region of the United States. It is clear that our output variable is wage and the input variables are the remaining variables in our data.</p><p>Wages in our data are quantitative values which means that we are facing a <strong>regression problem</strong>. Therefore, we are involved with predicting continuous or quantitative output.</p><p>Let&#39;s say we want to understand the association between an employee’s age, education, and calendar year on his wage. We can do this by visualizing the relationship between each of the input variables on wage using scatterplot and boxplot.</p><pre># Setup the matplotlib subplots<br>fig, ax = plt.subplots(1, 3, figsize=(15,4))<br><br># Fig 1<br>sns.regplot(data=df_wage, x=&#39;age&#39;, y=&#39;wage&#39;, lowess=True, ax=ax[0], scatter_kws={&#39;edgecolor&#39;: &#39;grey&#39;, &#39;facecolor&#39;: &#39;none&#39;, &#39;alpha&#39;: 0.5}, line_kws={&#39;color&#39;: &#39;red&#39;})<br><br># Fig 2<br>sns.regplot(data=df_wage, x=&#39;year&#39;, y=&#39;wage&#39;, lowess=True, ax=ax[1], scatter_kws={&#39;edgecolor&#39;: &#39;grey&#39;, &#39;facecolor&#39;: &#39;none&#39;, &#39;alpha&#39;: 0.5}, line_kws={&#39;color&#39;: &#39;red&#39;})<br><br># Fig 3<br>temp = {}<br>for i in df_wage[&#39;education&#39;].unique():<br>    temp[i] = df_wage[df_wage[&#39;education&#39;] == i][&#39;wage&#39;].reset_index(drop=True)<br>temp = pd.DataFrame(temp)<br>temp.columns = temp.columns.str.extract(r&#39;(\d)&#39;)[0].astype(int)<br>temp = temp[[i for i in range(1, 6)]]<br>temp.plot(kind=&#39;box&#39;, ax=ax[2], color=&#39;black&#39;, xlabel=&#39;education level&#39;, ylabel=&#39;wage&#39;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xicAyIfeuuj9BXriXqf8Hw.png" /><figcaption>Association for Age, Year, and Education Leve to Wage Respectively. Image by Author.</figcaption></figure><p>Based on the graph above we can see that:</p><ul><li>Wages increase with age until about 40 years old, then it slightly and slowly decreases after that.</li><li>Wages increased in a roughly linear (or straight-line) fashion, between 2003 and 2009, though this rise is very slight relative to the variability in the data.</li><li>Wages are also typically greater for individuals with higher education levels: men with the lowest education level (1) tend to have substantially lower wages than those with the highest education level (5).</li></ul><p>Of course, it is possible that we can get more accurate predictions by combining age, education, and the year rather than using each input variable separately. This can be done by fitting a machine learning model to predict one wage based on its age, education, and calendar year.</p><h3>2. Stock Market Data: Supervised Learning — Classification</h3><p>Let’s import the data.</p><pre># Import stock market data from ISLP<br>df_smarket = load_data(&#39;Smarket&#39;)<br>df_smarket</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RDsqxw215hFWF7C-Pq4raQ.png" /><figcaption>Stock Market Data. Image by Author.</figcaption></figure><p>This data contains the daily movements in the Standard &amp; Poor’s 500 (S&amp;P) stock index over 5 years between 2001 and 2005. In this case, we are involved with predicting qualitative or categorical output, i.e., today’s stock market direction. This type of problem is called a <strong>classification problem</strong>. A model that could accurately predict the direction in which the market will move would be very useful!</p><p>Let’s understand the data a little bit by understanding the pattern in which the market direction is up or down based on each of the lag1, lag2, and lag3 percentage changes in S&amp;P. We can do it by creating boxplots as follows:</p><pre># Setup the matplotlib subplots<br>fig, ax = plt.subplots(1, 3, figsize=(14, 4))<br><br># Fig 1<br>temp = {}<br>for i in df_smarket[&#39;Direction&#39;].unique():<br>    temp[i] = df_smarket[df_smarket[&#39;Direction&#39;] == i][&#39;Lag1&#39;].reset_index(drop=True)<br>temp = pd.DataFrame(temp)<br>temp.plot(kind=&#39;box&#39;, color=&#39;black&#39;, ax=ax[0], xlabel=&#39;Today\&#39;s Direction&#39;, ylabel=&#39;Percentage Change in S&amp;P&#39;, title=&#39;Yesterday&#39;)<br><br># Fig 2<br>temp = {}<br>for i in df_smarket[&#39;Direction&#39;].unique():<br>    temp[i] = df_smarket[df_smarket[&#39;Direction&#39;] == i][&#39;Lag2&#39;].reset_index(drop=True)<br>temp = pd.DataFrame(temp)<br>temp.plot(kind=&#39;box&#39;, color=&#39;black&#39;, ax=ax[1], xlabel=&#39;Today\&#39;s Direction&#39;, ylabel=&#39;Percentage Change in S&amp;P&#39;, title=&#39;Two Days Previous&#39;)<br><br># Fig 3<br>temp = {}<br>for i in df_smarket[&#39;Direction&#39;].unique():<br>    temp[i] = df_smarket[df_smarket[&#39;Direction&#39;] == i][&#39;Lag3&#39;].reset_index(drop=True)<br>temp = pd.DataFrame(temp)<br>temp.plot(kind=&#39;box&#39;, color=&#39;black&#39;, ax=ax[2], xlabel=&#39;Today\&#39;s Direction&#39;, ylabel=&#39;Percentage Change in S&amp;P&#39;, title=&#39;Three Days Previous&#39;)<br><br>plt.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dVLj7zlBF3F-cIGN9mLtJQ.png" /><figcaption>Boxplots for Today’s Stock Direction Based on Yesterday, Two Days Previous, and Three Days Previous of Percentage Change in S&amp;P. Image by Author.</figcaption></figure><p>Based on the graph above, it is clear that there is no visible difference between the percentage changes in S&amp;P in which today’s direction is up or down whether it’s for lag1 (yesterday), lag2 (two days previous), and lag3 (three days previous). It suggests that there is no simple strategy for predicting how the market will move based on these 3 variables. If the pattern seems quite simple, then anyone could adopt a simple trading strategy to generate profits from the market. Instead, this type of problem can be solved by a machine learning model to predict today’s market with high accuracy.</p><h3>3. Gene Expression Data: Unsupervised Learning — Dimensional Reduction &amp; Clustering</h3><p>Another important class of problems in machine learning involves situations in which we only observe input variables, with no corresponding output which is called <strong>unsupervised learning</strong>. Unlike in the previous examples, here we are not trying to predict an output variable.</p><p>Let’s check the example data from gene expression:</p><pre># Import gene expression data<br>df_gen = load_data(&#39;NCI60&#39;)<br>df_gen</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*KNXQ5h_RuwkV44iyBXxe9Q.png" /><figcaption>Gene Expression Data. Image by Author.</figcaption></figure><p>This data consists of 6,830 gene expression measurements for each of 64 cancer cell lines. Instead of predicting a particular output variable, we are interested in<strong> determining whether there are groups, or clusters</strong>, among the cell lines based on their gene expression measurements. This is a difficult question to address, in part because there are thousands of gene expression measurements per cell line, making it <strong>hard to visualize</strong> the data.</p><p>Here, we can use unsupervised learning techniques such as <strong>dimensionality reduction and clustering</strong> to better understand the pattern in our data.</p><p>Let’s code!</p><pre># PCA for the first two components<br>from sklearn.decomposition import PCA<br><br>pca = PCA(n_components = 2)<br>Z = pca.fit_transform(df_gen[&#39;data&#39;])<br><br># K-Means cluster for 4 clusters, just for illustration<br>from sklearn.cluster import KMeans<br><br>kmeans = KMeans(n_clusters=4)<br>kmeans.fit(Z)<br><br># Visualize the results<br>fig, ax = plt.subplots(1, 2, figsize=(10, 4))<br><br># Fig 1<br>ax[0].scatter(x=Z[:,0], y=Z[:,1], edgecolors=&#39;black&#39;, facecolor=&#39;none&#39;)<br>ax[0].set_xlabel(&#39;Z1&#39;)<br>ax[0].set_ylabel(&#39;Z2&#39;)<br><br># Fig 2<br>scatter = ax[1].scatter(x=Z[:,0], y=Z[:,1], c=kmeans.labels_)<br>legendc = ax[1].legend(*scatter.legend_elements(prop=&#39;colors&#39;), loc=&quot;upper left&quot;, title=&quot;Cluster&quot;)<br>ax[1].set_xlabel(&#39;Z1&#39;)<br>ax[1].set_ylabel(&#39;Z2&#39;)<br>plt.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/855/1*bcKLrfTX5ZZiB1zdH6oUjA.png" /><figcaption>Visualized Clusters from 64 Cancer Cell Lines Using the First 2 Principal Components. Image by Author.</figcaption></figure><p>We are using the first two principal components of the data, which summarize the 6,830 expression measurements for each cell line down to two numbers or dimensions. <em>While it is likely that this dimension reduction has resulted in some loss of information, it is now possible to visually examine the data for evidence of clustering</em>. Deciding on the number of clusters is often a difficult problem. In the graph above, we are using 4 clusters for the sake of illustration. Based on this graph, there is clear evidence that cell lines with reasonably similar characteristics tend to be located near each other in this two-dimensional representation.</p><p>To be continued…</p><p>This is a part of my 100 days Data Science learning journey. Follow me for more updates on my learning.</p><p>You can learn from what I learned too!</p><p>Check out my plan: <a href="https://medium.com/pythons-gurus/a-journey-to-learn-data-science-100-days-plan-cfce919f6f6e">https://medium.com/pythons-gurus/a-journey-to-learn-data-science-100-days-plan-cfce919f6f6e</a></p><h3>Python’s Gurus🚀</h3><p><em>Thank you for being a part of the </em><a href="https://medium.com/pythons-gurus"><strong><em>Python’s Gurus community</em></strong></a><strong><em>!</em></strong></p><p><em>Before you go:</em></p><ul><li>Be sure to <strong>clap x50 time </strong>and <strong>follow</strong> the writer ️👏<strong>️️</strong></li><li>Follow us: <a href="https://medium.com/pythons-gurus/newsletters/gurus-advisor"><strong>Newsletter</strong></a></li><li>Do you aspire to become a Guru too? <strong><em>Submit your best article or draft</em></strong> to reach our audience.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a5f706f88bd9" width="1" height="1" alt=""><hr><p><a href="https://medium.com/pythons-gurus/an-introduction-to-statistical-learning-introduction-a5f706f88bd9">An Introduction to Statistical Learning — Introduction</a> was originally published in <a href="https://medium.com/pythons-gurus">Python’s Gurus</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introduction to Mathematical Statistics — Probability and Distributions (1)]]></title>
            <link>https://medium.com/pythons-gurus/introduction-to-mathematical-statistics-probability-and-distributions-1-86d971de6eae?source=rss-3954ba6af883------2</link>
            <guid isPermaLink="false">https://medium.com/p/86d971de6eae</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[statistics]]></category>
            <category><![CDATA[mathematics]]></category>
            <category><![CDATA[probability]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Ahmad Yusuf Albadri]]></dc:creator>
            <pubDate>Mon, 17 Jun 2024 09:49:03 GMT</pubDate>
            <atom:updated>2024-06-17T10:43:49.349Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction to Mathematical Statistics — Probability and Distributions (1)</h3><h4>Day 1 notes from the “Introduction to Mathematical Statistics, 8th Edition by Hogg, et. al.” as part of my Data Science learning documentation.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*eifQPKL7nWt5HH_Z" /><figcaption>Photo by <a href="https://unsplash.com/@tamiminaser?utm_source=medium&amp;utm_medium=referral">Naser Tamimi</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4>Experimentation is the standard procedure for investigation.</h4><p>Such investigation examples can be as follows:</p><ul><li>In medical research, researchers try to understand the effect of drugs.</li><li>Economists try to understand the impact of different prices on the demands of a certain commodity.</li><li>Agronomists may wish to study how a chemical fertilizer affects the yield of a cereal grain.</li></ul><p>We can gain meaningful information to answer such investigations by performing experiments.</p><ul><li>Each experiment terminates with an <em>outcome</em>. However, the outcome of an experiment cannot be predicted with certainty.</li><li>If the outcome of an experiment can be described before it starts, and the way we execute the experiment can be repeated under the same conditions, then this kind of experiment is called a <strong>random experiment</strong>.</li><li>The collection of every possible outcome from an experiment is called <strong>sample space</strong>.</li></ul><p>A simple example of a random experiment, <strong>example 1</strong>:</p><p>In the experiment of tossing a coin, the outcome might be Head (H) or Tail (T). If we assume that the coin may be repeatedly tossed under the same conditions, then the toss of this coin is an example of a random experiment with a sample space:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/156/1*_BXIZx6jzO17juFXcQQXCw.png" /><figcaption>Sample space “C” of a random experiment of tossing a coin: head or tail</figcaption></figure><ul><li>Often we are interested in the chances of certain subsets of elements of the sample space occurring. <strong>This subset is called events</strong>.</li><li>If the experiment results in an element in an event “A”, then we say the event “A” has occurred.</li><li>From <strong>example 1</strong>, we may be interested in the chances of getting head. Mathematically, we can write it as follows:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/120/1*3G0ji-e-uj2pNaCOvRR0Rw.png" /><figcaption>“A” is an event of getting head from a toss of a coin</figcaption></figure><ul><li>To get the chance, we need to observe how many times Head occurred out of N repeated times we toss a coin. This value can be represented mathematically as:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/29/1*gS1KPJtXcszOyBqQ8RwSsA.png" /><figcaption>This is an example of the relative frequency of observing head out of N repeatedly times tossing a coin</figcaption></figure><ul><li>A relative frequency is usually quite erratic for small values of N, as you can discover by tossing a coin. But as N increases, experience indicates that we associate with the event “A” a number, say “p”, that is equal or approximately equal to that number about which the relative frequency seems to stabilize. <strong>This “p” is usually called the probability of an event</strong>.</li></ul><h3>Represent “p” in Python as N increases</h3><p>Let’s visualize the relative frequency as a representation of “p” from <strong>example 1</strong> as follows:</p><pre># Import library<br>import numpy as np<br>import matplotlib.pyplot as plt<br><br># Simulate data, with p=0.5 for show head<br>N = [i for i in range(10, 1000, 1)]<br>p = [np.mean(np.random.binomial(1, 0.5, i)) for i in N ]<br><br># Visualize<br>plt.scatter(x=N, y=p, alpha=0.5, edgecolors=&#39;black&#39;, facecolor=&#39;none&#39;)<br>plt.axhline(y=0.5, color=&#39;red&#39;, linestyle=&#39;--&#39;, linewidth=2)<br>plt.annotate(&#39;--- p = 0.5&#39;, xy=(850,0.73), color=&#39;red&#39;)<br>plt.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/567/1*rjLTQY1boHiRW6-79_qjoA.png" /><figcaption>In a simulation for tossing a fair coin, thus the probability of showing a head is equal to 0.5</figcaption></figure><p>As we can see from the graph above as N increases, the “p” or the probability of showing the head slowly converges to 0.5.</p><p>This is a part of my 100 days Data Science learning journey. Follow me for more updates on my learning.</p><p>You can learn from what I learned too!</p><p>Check out my plan: <a href="https://medium.com/pythons-gurus/a-journey-to-learn-data-science-100-days-plan-cfce919f6f6e">https://medium.com/pythons-gurus/a-journey-to-learn-data-science-100-days-plan-cfce919f6f6e</a></p><h3>Python’s Gurus🚀</h3><p><em>Thank you for being a part of the </em><a href="https://medium.com/pythons-gurus"><strong><em>Python’s Gurus community</em></strong></a><strong><em>!</em></strong></p><p><em>Before you go:</em></p><ul><li>Be sure to <strong>clap x50 time </strong>and <strong>follow</strong> the writer ️👏<strong>️️</strong></li><li>Follow us: <a href="https://medium.com/pythons-gurus/newsletters/gurus-advisor"><strong>Newsletter</strong></a></li><li>Do you aspire to become a Guru too? <strong><em>Submit your best article or draft</em></strong> to reach our audience.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=86d971de6eae" width="1" height="1" alt=""><hr><p><a href="https://medium.com/pythons-gurus/introduction-to-mathematical-statistics-probability-and-distributions-1-86d971de6eae">Introduction to Mathematical Statistics — Probability and Distributions (1)</a> was originally published in <a href="https://medium.com/pythons-gurus">Python’s Gurus</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Journey to Learn Data Science: 100 Days Plan]]></title>
            <link>https://medium.com/pythons-gurus/a-journey-to-learn-data-science-100-days-plan-cfce919f6f6e?source=rss-3954ba6af883------2</link>
            <guid isPermaLink="false">https://medium.com/p/cfce919f6f6e</guid>
            <category><![CDATA[mathematics]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[statistics]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Ahmad Yusuf Albadri]]></dc:creator>
            <pubDate>Sat, 15 Jun 2024 13:53:13 GMT</pubDate>
            <atom:updated>2024-06-17T06:49:52.042Z</atom:updated>
            <content:encoded><![CDATA[<h4>A simple plan to learn and hone skills in data science within 100 days starting from Sun, 16 Jun 2024.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*zCzQZVfYzH9pYC4B" /><figcaption>Photo by <a href="https://unsplash.com/@jaredd?utm_source=medium&amp;utm_medium=referral">Jaredd Craig</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Hi, welcome to my article on how I plan my learning journey in Data Science!</p><p>I’m Yusuf, a former Data Scientist (Analytics) at Tokopedia, one of the biggest E-Commerce companies in Indonesia, which ByteDance acquired in early 2024.</p><p>The recent layoff impacted me on 14 Jun 2024, which made me lose my job.</p><p>On the positive side, this could be a great moment to hone my skills in Data Science and finish my list of Data Science books that I haven’t finished while working as a Data Scientist.</p><blockquote>The plan is simple: understand at least 5 pages of each book daily and document it digitally.</blockquote><p>I will focus on finishing these 5 books within the next 100 days starting on 16 June 2024. These books will cover the fundamentals of Data Science starting from mathematics, statistics, machine learning, causal inference, and programming. Three out of five of these books are open source.</p><h4>1. Mathematics for Machine Learning</h4><p>Free resource: <a href="https://mml-book.github.io/">https://mml-book.github.io/</a></p><h4>2. Introduction to Mathematical Statistics, 8th Edition</h4><h4>3. An Introduction to Statistical Learning: with Applications in Python</h4><p>Free resource: <a href="https://www.statlearning.com/">https://www.statlearning.com/</a></p><h4>4. Practical Statistics for Data Scientists: 50+ Essential Concepts using R and Python</h4><h4>5. Causal Inference: What If</h4><p>Free resource: <a href="https://www.hsph.harvard.edu/miguel-hernan/causal-inference-book/">https://www.hsph.harvard.edu/miguel-hernan/causal-inference-book/</a></p><p>I’m planning to use Medium as one of my digital learning documentation.</p><p>For the programming language, I will use Python.</p><p>Don’t forget to follow me on Medium for more updates on my learning journey. You can gain insights and learn from what I learned too!</p><p>Happy learning!</p><h3>Python’s Gurus🚀</h3><p><em>Thank you for being a part of the </em><a href="https://medium.com/pythons-gurus"><strong><em>Python’s Gurus community</em></strong></a><strong><em>!</em></strong></p><p><em>Before you go:</em></p><ul><li>Be sure to <strong>clap x50 time </strong>and <strong>follow</strong> the writer ️👏<strong>️️</strong></li><li>Follow us: <a href="https://medium.com/pythons-gurus/newsletters/gurus-advisor"><strong>Newsletter</strong></a></li><li>Do you aspire to become a Guru too? <strong><em>Submit your best article or draft</em></strong> to reach our audience.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cfce919f6f6e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/pythons-gurus/a-journey-to-learn-data-science-100-days-plan-cfce919f6f6e">A Journey to Learn Data Science: 100 Days Plan</a> was originally published in <a href="https://medium.com/pythons-gurus">Python’s Gurus</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Learn These 3 Topics for Success in Data Science]]></title>
            <link>https://medium.com/@ahmadyusufalbadri/learn-these-3-topics-for-success-in-data-science-4065ffdb42d7?source=rss-3954ba6af883------2</link>
            <guid isPermaLink="false">https://medium.com/p/4065ffdb42d7</guid>
            <category><![CDATA[statistics]]></category>
            <category><![CDATA[linear-algebra]]></category>
            <category><![CDATA[data-analytics]]></category>
            <category><![CDATA[calculus]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Ahmad Yusuf Albadri]]></dc:creator>
            <pubDate>Sat, 01 Jun 2024 10:45:15 GMT</pubDate>
            <atom:updated>2024-06-01T10:45:15.622Z</atom:updated>
            <content:encoded><![CDATA[<h4>Calculus, Linear Algebra, and Statistics</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*tpkikYQKSzjQds4L" /><figcaption>Photo by <a href="https://unsplash.com/@ratushny?utm_source=medium&amp;utm_medium=referral">Dmitry Ratushny</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>What comes to your mind when you stumble upon a term called Data Science? Is it about AI (Artificial Intelligence), ML (Machine Learning), A/B test, or simply Data Analysis using complex or fancy methods and technologies?</p><blockquote>Whatever it is, Data Science is simply a study that discuss about solving problems with data.</blockquote><p>Then, if we want to solve problems with data, what do we need to know? specifically, <strong>what skills are required for applying Data Science, thus solving problems effectively?</strong></p><p>Think about it.</p><p>Even if you surf the internet, you will find many articles suggesting learning Python, SQL, and other tools with endless options. This is not wrong, but I think it’s ineffective. Why?</p><blockquote>Because a tool is just a tool. No more, no less.</blockquote><p>Instead, you have to start with the basics, the fundamentals, which are used for understanding data and how methods work the way they are thus you can find so many possible ways that can be used to solve your problems.</p><p>What are these fundamentals?</p><p>Well, as you’ve seen in the subtitle, it consists of <strong>calculus, linear algebra, and statistics</strong>.</p><p>In this short article, I will point out my <strong>key practical takeaways </strong>on why you must learn these 3 topics to succeed in Data Science.</p><h3>Calculus</h3><ul><li>It helps you understand how to <strong>optimize a real problem mathematically</strong>. You will also understand what each method in Data Science tries to optimize and how.</li></ul><h3>Linear Algebra</h3><ul><li>Linear algebra is the study of linear maps on finite-dimensional vector spaces. Therefore, by knowing linear algebra you can <strong>“visualize” and internalize how vector works in formalizing problems mathematically</strong>.</li><li>You can also <strong>operate things efficiently</strong> when stated as vectors. For example, when you want to find the betas that minimize the MSE (Mean Squared Error) in linear regression.</li></ul><h3>Statistics</h3><blockquote>Some say that Data Science is the modern statistics. It might be true because nearly all concepts in Data Science came from statistics.</blockquote><ul><li>Descriptive statistics, help you <strong>describe and understand your data from a high-level point of view</strong>. This includes making effective data visualization and finding the right measures to look into the typical number and how our data varies.</li><li>Inferential statistics, help you <strong>make conclusions about the population with just its samples</strong>. The A/B test is part of inferential statistics, thus knowing inferential statistics will make you become a more effective experimenter.</li></ul><h4>Do you have other perspectives? Or do you think something is missing that needs to be added? If yes, don’t hesitate to comment and share your thoughts.</h4><p>Thank you for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4065ffdb42d7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Idea of Synthetic Control for Assessing Causal Effect on a Temporal Data with One Treated Unit]]></title>
            <link>https://medium.com/@ahmadyusufalbadri/the-idea-of-synthetic-control-for-assessing-causal-effect-on-a-temporal-data-with-one-treated-unit-5c72cb012803?source=rss-3954ba6af883------2</link>
            <guid isPermaLink="false">https://medium.com/p/5c72cb012803</guid>
            <category><![CDATA[analytics]]></category>
            <category><![CDATA[causal-inference]]></category>
            <category><![CDATA[causality]]></category>
            <category><![CDATA[data-analyst]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Ahmad Yusuf Albadri]]></dc:creator>
            <pubDate>Wed, 28 Jun 2023 05:05:09 GMT</pubDate>
            <atom:updated>2023-06-28T05:05:09.048Z</atom:updated>
            <content:encoded><![CDATA[<h4>A strong observational study to assess causal effect when we can’t use experimentation or A/B test and there is only one treated unit.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*oxxEL6tDL-9i_dZ3" /><figcaption>Photo by <a href="https://unsplash.com/@markusspiske?utm_source=medium&amp;utm_medium=referral">Markus Spiske</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>The faster development of technology enables businesses to adapt and innovate more quickly in developing their products. Minimum Viable Product (MVP) is the choice in developing or even making new products because it is easy to make without requiring a long period of time. With MVP, early customers can then provide feedback for future product development. Often this MVP is launched in certain market segments, one of which is based on geographical location.</p><p>Let’s take an example of assessing the impact of MVP in the fashion industry, let&#39;s say that you have a fashion company that is currently focusing on increasing the monthly revenue from your offline store. You have 20 stores spread across 20 different cities. Your team has come up with an idea to enable a membership program that provides a seamless experience to transact on your offline store and supply different kinds of benefits from special discounts to cashback. But, to be able to launch this initiative to all of the 20 stores would be costly and might not guarantee success in driving revenue and your company is only able to support this initiative to launch on a particular store. So, you only have 1 store to get this program and the remaining 19 stores don’t, also this condition makes you can’t to do experimentation. Let&#39;s say, you choose store ABC based on the promising performance of last year’s performance.</p><p>You want this program to live for a year starting next year so that the seasonality of the yearly sales can be catered to. After that, you want to see whether this program is really generating an increase in revenue or not. To understand its impact, you have to know what would have happened to store ABC without the membership program so you know how the membership program affects your revenue by calculating the difference between the situation when there is a membership program and when it doesn’t. Unfortunately, we can’t observe the latter situation since you already choose store ABC to get the membership program, hence we need another way to mimic the situation — which refers to estimating a counterfactual outcome. For this particular scenario, the synthetic control method is the way-to-go method for assessing the causal effect of this membership program on the increase in monthly revenue.</p><p>Synthetic control allows us to do causal inference when we have as few as one treated unit and many control units and we observe them over time. The idea is to combine the untreated units so that they mimic the behavior of the treated unit as closely as possible, without the treatment (in the pre-treatment period) to construct the counterfactual. These untreated units combined will create a synthetic unit or synthetic control unit. This synthetic control unit is used as the counterfactual of store ABC which has a membership program, i.e., it estimates what would have happened to store ABC if the membership program had not launched.</p><p>What about inference? Is the estimate significantly different from zero? Or, more practically, “How unusual is this estimate under the null hypothesis of no membership effect?”. We have to perform a randomization/permutation test in order to answer this question. The idea is that if the membership program has no effect, the effect we observe for store ABC should not be significantly different from the effect we observe for any other 19 stores. Then, we can see whether the effect of the membership program is significant and how much it increases or decreases the revenue.</p><p>That’s it, I hope that you can understand which case the synthetic control method could handle to assess the causal effect when we can’t do experimentation (A/B test).</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5c72cb012803" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[[Let’s Think!] What is Data?]]></title>
            <link>https://medium.com/@ahmadyusufalbadri/lets-think-what-is-data-ec333103d995?source=rss-3954ba6af883------2</link>
            <guid isPermaLink="false">https://medium.com/p/ec333103d995</guid>
            <category><![CDATA[statistics]]></category>
            <category><![CDATA[data]]></category>
            <category><![CDATA[data-analyst]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[data-analytics]]></category>
            <dc:creator><![CDATA[Ahmad Yusuf Albadri]]></dc:creator>
            <pubDate>Sat, 04 Feb 2023 02:32:21 GMT</pubDate>
            <atom:updated>2023-02-04T02:32:21.169Z</atom:updated>
            <content:encoded><![CDATA[<h4>A quick discussion about the definition of data using our rational capabilities</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ZQ7lYunp5f9j8SL7" /><figcaption>Photo by <a href="https://unsplash.com/@hostreviews?utm_source=medium&amp;utm_medium=referral">Stephen Phillips - Hostreviews.co.uk</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Hi data folks, welcome to my medium article!</p><p>This article will urge us to think (for those who are new in the data field) or even re-think (for those who have experience in handling data) the definition of data by answering a fundamental question which is:</p><blockquote>What is Data?</blockquote><h3>My Thought</h3><p>Okay, so.. what is data?</p><p>I urge you to take 5 minutes to try answering this question by yourself. It is because your definition might differ from what I will present which comes from my thought.</p><p>Done? Okay, let’s continue our discussion.</p><p>From my perspective which is heavily related to my experience in data analytics and statistics,</p><blockquote>Data is something that represent something that we can collect, analyze, and interpret.</blockquote><p>As you can see that there are four main takeaways from the definition above to categorize “something” as data:</p><ol><li><em>Represents something</em>,</li><li><em>can be collected,</em></li><li><em>analyzed,</em></li><li>and <em>interpreted</em>.</li></ol><p>Therefore, any form of thing that represents another thing that exists in our reality that can be collected, analyzed, and interpreted is defined as data.</p><p>But, maybe, there is something that can be collected but can’t be analyzed either because of the current technology constraint or because we simply don’t know if that thing can be analyzed in some form of any scientific or non-scientific method. The latter is not considered data since we rationally don’t know how to analyze it thus it can’t be analyzed even if humanity has achieved a more advanced science, technology, or even rational capability from the current period when this article is published.</p><p>The collection of data does not need to have a form of numeric values like in the table format. It can be other things like images, sounds, or texts as long as they represent something. The form of data might get more diverse along with technological and scientific development.</p><p>If numerical values in the table format are not represent anything and only consist of random numbers then it is not data. Instead, it is just dummy data since it is already collected in the table format with numerical values in it, it can be analyzed using quantitative methods, and it can be interpreted with some assumption of context in mind.</p><h4>That’s it! What about yours? Don’t hesitate to comment with your definition. Let’s discuss it!</h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ec333103d995" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Single Book That You Need to Help your Practical Data Science Journey]]></title>
            <link>https://medium.com/@ahmadyusufalbadri/a-single-book-that-you-need-to-help-your-practical-data-science-journey-17abeafb7c8a?source=rss-3954ba6af883------2</link>
            <guid isPermaLink="false">https://medium.com/p/17abeafb7c8a</guid>
            <category><![CDATA[data-scientist]]></category>
            <category><![CDATA[data-scientist-skills]]></category>
            <category><![CDATA[data-analytics]]></category>
            <category><![CDATA[data-analyst]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Ahmad Yusuf Albadri]]></dc:creator>
            <pubDate>Sat, 22 Oct 2022 03:04:19 GMT</pubDate>
            <atom:updated>2022-10-22T03:04:19.646Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*epjmxg2jsrApCRPz" /><figcaption>Photo by <a href="https://unsplash.com/@dollargill?utm_source=medium&amp;utm_medium=referral">Dollar Gill</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Hi guys, welcome to my story! My name is Yusuf, I’m a Data Analyst at a technology company in Indonesia. In this article, I would like to share my latest learning journey to learn data science in a practical way (I am also just starting to learn from this :D).</p><p>But first, I might guess that those of you who read this article are at a beginner or intermediate level of your data science journey. Don’t worry, I am also just a beginner too, I’m still learning how to be a good and reliable data analyst in my current job and I’m still a newbie too in the field :D (sometimes I experience impostor syndrome too, haha!)</p><p>Because of that, I want to learn and horn my skills as a Data Analyst so I can help my stakeholders and company better (also, I love to share my learning journey starting from this article ❤). One approach that I do is by learning from books. Yes, books guys! Of course to learn from a book or even a textbook we need to be patient right? Since we are self-learners in this context and our mentor is the book itself (undirectly is the author :D) and it is our own responsibility to understand the concept within the book within a reasonable amount of time that we have.</p><p>The book that I want to tell you about is …</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1002/1*-nbE_IIIf_a6ozeFfEMRcg.png" /><figcaption>Practical Statistics for Data Scientists, 2nd Ed. 2020</figcaption></figure><p>TADAAA!!!</p><blockquote>Practical Statistics for Data Scientist by Peter Bruce, Andrew Bruce, and Peter Gedeck</blockquote><p>With this book, you will learn:</p><ol><li>Why exploratory data analysis is a key preliminary step in data science</li><li>How random sampling can reduce bias and yield a higher-quality dataset, even with big data</li><li>How the principles of experiment design yield definitive answers to questions</li><li>How to use regression to estimate outcomes and detect anomalies</li><li>Key classification techniques for predicting which categories a record belongs to</li><li>Statistical machine learning methods that “learn” from data</li><li>Unsupervised learning methods for extracting meaning from unlabeled data</li></ol><p>I think, personally, the topics that this book covers are covering 80% of data science topics that we’ll need in the industry. It is also focusing on the practical side by using programming languages such as R and Python. YES! you can choose whether you want to follow the book using R or Python or maybe both of them! That is one of the advantages that this book has, you can pick R or Python in your learning journey.</p><p>Fyi, I am more of an R guy :D, but I am also learning and using Python. Like human languages, I am more capable to use Bahasa Indonesia but I also learn and use English at the same time, even in this article :D</p><p>From this post, I am still 10% of my progress in learning this book. So, there is still much to learn!</p><p>Oh ya, I want to ask you, yes you… What do you think if I’m about to continue to write things that I’ve learned from this book in another article?</p><p>Is it interest you or not? Please comment yaa, I want to know the responses from all of you :D</p><p>P.s. I will use Python to follow the book since I am still weak in using the language.</p><p>Happy Learning!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=17abeafb7c8a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Grouping Districts and Cities in East Java Based on Its Economic Inequality Metrics Through the…]]></title>
            <link>https://medium.com/@ahmadyusufalbadri/grouping-districts-and-cities-in-east-java-based-on-its-economic-inequality-metrics-through-the-2b75d658c7d7?source=rss-3954ba6af883------2</link>
            <guid isPermaLink="false">https://medium.com/p/2b75d658c7d7</guid>
            <category><![CDATA[r]]></category>
            <category><![CDATA[spatial]]></category>
            <category><![CDATA[clustering]]></category>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Ahmad Yusuf Albadri]]></dc:creator>
            <pubDate>Mon, 06 Dec 2021 06:14:33 GMT</pubDate>
            <atom:updated>2021-12-07T00:20:34.857Z</atom:updated>
            <content:encoded><![CDATA[<h3>Grouping Districts and Cities in East Java Based on Its Economic Inequality Metrics Through the Implementation of the SKATER Method</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*UHkC-mYbeUD6EGVx" /><figcaption>Photo by <a href="https://unsplash.com/@homajob?utm_source=medium&amp;utm_medium=referral">Scott Graham</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Hello, data folks! Welcome to my first story in medium! In this story, I would like to share my recent project in data science. As you can see from the title above that I’ve used the SKATER method to group the districts and cities in the East Java Province of Indonesia based on its economic inequality metrics. It was a challenging project and I learned a lot from it. I hope that you can learn something too from this project! Take a seat and grab a cup of coffee while reading my story, have fun!</p><h3>Methodology</h3><p>Regionalization is a classification procedure applied to spatial objects with an areal representation, which groups them into homogeneous contiguous regions (Assuncao, Neves, Camara, &amp; Freitas, 2006). Regionalization is carried out using the SKATER (<em>Spatial ‘K’luster Analysis by Tree Edge Removal</em>) method. The first step is to create a connectivity graph that captures the neighborhood relationship between the spatial objects. The neighborhood structure of a connectivity graph is summarized by a minimum spanning tree (MST), which is a connected tree with no circuits. The partition of the MST was done by successive removal of edges that link dissimilar regions. The result is the division of the spatial objects into connected regions that have maximum internal homogeneity. The illustration of a connectivity graph and its MST is provided in <strong>Figure 1</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/583/1*KHu0QDqRvATusLi75ZgJmQ.png" /><figcaption><strong>Figure 1. </strong>(a) Connectivity Graph, (b) Minimum Spanning Tree</figcaption></figure><p>The grouping using the SKATER method was carried out on districts and cities in East Java Province based on its economic inequality. The economic inequality is represented by several variables which include the Gini Ratio, L Index, and Theil Index. The data used in each of these variables was obtained in 2020. Then the grouping process is carried out using the help of the <strong>R programming language</strong> based on the SKATER method with the following steps:</p><ol><li>Check the existence of spatial autocorrelation as a representation of the spatial effect for each variable using the Moran’s I test.</li><li>Create a connectivity graph.</li><li>Standardize the data.</li><li>Determine the Minimum Spanning Tree (MST)</li><li>Partitioning MST into groups.</li><li>Choose the best number of clusters based on the MANOVA test.</li><li>Interpret the best number of clusters from the result of the MANOVA test.</li></ol><h3>Result</h3><h4>Spatial Autocorrelation Test</h4><p>The spatial effects of each variable can be traced using the spatial autocorrelation test based on Moran’s I statistics. The results of the Moran’s I test for each variable can be seen in <strong>Table 1</strong> with H0 (null hypothesis) for no spatial autocorrelation. Based on the test results in <strong>Table 1</strong>, it can be seen that the decision obtained is to reject H0 for each variable because the p-value of each variable has a value smaller than the 5% significance level. Therefore, it can be concluded that all variables, namely Gini Ratio, L Index, and Theil Index, have a spatial effect for districts and cities in East Java Province.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/618/1*fPXWahqnKuV99ZhewaFjug.png" /><figcaption><strong>Table 1. </strong>Moran’s I Result</figcaption></figure><h4>Cluster Analysis with the SKATER Method</h4><p>The first thing that needs to be done is to form a connectivity graph based on the neighbors between coordinate points (longitude and latitude) for districts and cities in East Java Province. The neighbors are obtained based on the K Nearest Neighbours approach for each point with four neighbors. The connectivity graph that is formed can be seen in <strong>Figure 2</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/586/1*FOGZm1g6r0PrTbMj8Bk_Kg.png" /><figcaption><strong>Figure 2. </strong>Connectivity Graph</figcaption></figure><p>The connectivity graph that has been formed is summarized into a Minimum Spanning Tree (MST) which connects each tree without forming a circuit as shown in <strong>Figure 3</strong>. In the figure, it can be seen that there is no circuit shape. Furthermore, MST will be partitioned to form several homogeneous clusters.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/656/1*yipchqeadMe2IWXrPmFC2Q.png" /><figcaption><strong>Figure 3. </strong>Minimum Spanning Tree</figcaption></figure><p>Clusters were formed from two to five groups obtained based on the results of the MST partition. The partition results for the four clusters can be seen in <strong>Figure 4</strong>. Details of the districts and cities included in these clusters can be seen in <strong>Table 2</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iE_JPbW9jpdpKZUABwzGDA.png" /><figcaption><strong>Figure 4. </strong>MST Partition Results for Each Number of Clusters</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/581/1*mqtFEsL8vre_-fmFxGmVKA.png" /><figcaption><strong>Table 2. </strong>District-City’s MST Partition Results for Each Number of Clusters</figcaption></figure><h4>Determination of the Best Clusters Based on MANOVA (<em>Multivariate Analysis of Variance</em>)</h4><p>MANOVA is used to compare and determine the best number of clusters. MANOVA results from each number of clusters can be seen in <strong>Table 3</strong> as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/445/1*zFDEvA3Q_oinZpkwIwyoag.png" /><figcaption><strong>Table 3. </strong>MANOVA Results for Each Number of Clusters</figcaption></figure><p>Based on <strong>Table 3</strong>, it can be seen that each number of clusters has a significant MANOVA test result because the p-value of each number of clusters is smaller than the 5% significance level. Then the number of the best clusters can be determined based on the highest Pillai’s Trace value in <strong>Table 3</strong>. Five clusters are the best clusters because they have the highest Pillai’s Trace value of 0,5856.</p><h4>Interpretation of The Best Number of Clusters</h4><p>Based on the results of the MANOVA test, it is known that the five clusters are the best clusters obtained from the SKATER method for the Gini Ratio, L Index, and Theil Index variables for urban districts in East Java Province. The characteristics of each cluster based on the average value of the three variables can be seen in <strong>Table 4</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/473/1*KoApyUliCOtAirkq0vaVew.png" /><figcaption><strong>Table 4. </strong>Clusters Characteristics Based on Variable Mean</figcaption></figure><p>Based on <strong>Table 4</strong>, it can be seen that cluster 5, cluster 4, cluster 3, cluster 1, and cluster 2 are clusters that have the largest to smallest values sequentially for each variable. Therefore, cluster 5 and cluster 2 are the clusters with the highest and lowest levels of inequality in East Java Province respectively. The pattern of the level of economic inequality that occurs from each of these clusters can be used as a priority reference for the government to make strategic plans in the form of policies and/or programs to overcome the problem of economic inequality that occurs in East Java Province effectively and proportionally for each district and cities based on the cluster which has been formed.</p><h3>Summary</h3><p>The best number of clusters obtained based on the SKATER method is five clusters. The map of the distribution of the cluster can be seen in <strong>Figure 5</strong> as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/613/1*QVNAH6bZDJmmY2IMebajig.png" /><figcaption><strong>Figure 5. </strong>The Best Clusters of the SKATER Method</figcaption></figure><p>Details of the city districts included in the cluster can be seen in <strong>Table 5</strong> as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/748/1*zIsaSSAnyIvOXrt45Zhoxg.png" /><figcaption><strong>Table 5. </strong>Details of the District/City of the Best Clusters</figcaption></figure><p>Based on <strong>Table 4</strong>, it can be seen that cluster 5, cluster 4, cluster 3, cluster 1, and cluster 2 are clusters that have the largest to the smallest values sequentially for each variable so that they can be used as priorities in the procurement of strategic plans for overcoming economic inequality in the East Java Province.</p><h3>References</h3><p>Assuncao, R. M., Neves, M. C., Camara, G., &amp; Freitas, C. D. (2006). Efficient Regionalization Techniques for Socio-Economic Geographical Units Using Minimum Spanning Trees. <em>International Journal of Geographical Information Science, XX</em>(7), 797–811.</p><p>I’m also created a web app using shiny in R to visualize the SKATER method interactively.</p><p><a href="https://ahmad-yusuf-albadri.shinyapps.io/SKATER-EastJava/">SKATER for Economic Inequality in East Java</a></p><p>Also, check my GitHub repository for this project to see the code.</p><p><a href="https://github.com/ayusufalba25/SKATER-for-Economic-Inequality-in-East-Java">GitHub - ayusufalba25/SKATER-for-Economic-Inequality-in-East-Java: Grouping Districts and Cities in East Java Based on Its Economic Inequality Metrics Through the Implementation of the SKATER Method</a></p><p>Want to collaborate? Let’s connect on <a href="https://www.linkedin.com/in/ahmad-yusuf-a-ab5696130/"><em>LinkedIn</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2b75d658c7d7" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>