<?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 Gokul on Medium]]></title>
        <description><![CDATA[Stories by Gokul on Medium]]></description>
        <link>https://medium.com/@gokulkarthikk?source=rss-fcbd78e83361------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*-Fly10ICAt3YQdTQZTMsHQ@2x.jpeg</url>
            <title>Stories by Gokul on Medium</title>
            <link>https://medium.com/@gokulkarthikk?source=rss-fcbd78e83361------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 21:48:25 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@gokulkarthikk/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[Experience @ ACM Summer School of Data Science, Goa]]></title>
            <link>https://medium.com/@gokulkarthikk/day-1-acm-summer-school-of-data-science-goa-9afff5d6b51f?source=rss-fcbd78e83361------2</link>
            <guid isPermaLink="false">https://medium.com/p/9afff5d6b51f</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[linear-algebra]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Gokul]]></dc:creator>
            <pubDate>Mon, 04 Jun 2018 19:40:55 GMT</pubDate>
            <atom:updated>2022-08-10T17:08:13.191Z</atom:updated>
            <content:encoded><![CDATA[<p>Authored by myself and <a href="https://medium.com/u/21eb61fc7d9f">Thilagraj</a> :</p><p>I am a senior Information Technology student at Thiagarajar College of Engineering, Madurai, and <a href="https://medium.com/u/21eb61fc7d9f">Thilagraj</a> is a senior student pursuing Civil Engineering and Production Engineering respectively at the National Institute of Technology, Trichy.</p><p>Harvard business review regarded “Data Scientist” as the sexiest job in the 21st century. GlassDoor named it as the best job in America for this year. These are not the only motivations that connected us in pursuing data science in our free time but also the business and societal impact that we can make with the data!</p><p>I am very happy to share that we are part of the 30 engineering students selected for the<a href="https://sites.google.com/site/harishguruprasad/ml-summer-school-june-2018"> ACM Summer School of Data Science, Goa</a> among 1000+ nationwide applicants. We thank ACM India, Robert Bosch Centre for Data Science and Artificial Intelligence (IIT Madras) and Goa University for the opportunity to explore this disruptive topic at the India’s most beautiful place ❤. This 2 week program covers topics ranging from mathematical foundations to advance topics in data science like deep learning and reinforcement learning with the blend of theory and hands-on sessions by the domain experts from various Indian Institute of Technologies. The video recordings of theory sessions will be made available to the public through the Swayam portal which is initiated by the Ministry of Human Resources and Development, Government of India. However we decided to share our *important* learning precisely on each day :)</p><p><strong>TABLE OF CONTENTS:</strong></p><blockquote>1. Speaker Introduction</blockquote><blockquote>2. Why Learn Linear Algebra?</blockquote><blockquote>3. Vectors And Matrices</blockquote><blockquote>4. Vector Properties</blockquote><blockquote>== a. Scalar Multiplication</blockquote><blockquote>== b. Vector Addition</blockquote><blockquote>5. Vector Operations</blockquote><blockquote>== a. Distance Between Two Vectors</blockquote><blockquote>== b. Dot Product</blockquote><blockquote>== c. Scalar Projection</blockquote><blockquote>6. Linear Combination Of Vectors</blockquote><blockquote>7. Matrix Rank</blockquote><blockquote>8. Types Of Matrices</blockquote><blockquote>9. Solving System of Linear Equations</blockquote><blockquote>== a. Naive Gauss Elimination</blockquote><blockquote>== b. LU Decomposition</blockquote><blockquote>== c. QR Factorization</blockquote><blockquote>10. Eigen Values And Eigen Vectors</blockquote><blockquote>11. Tutorial</blockquote><h3><strong>1. Speaker Introduction:</strong></h3><p>Dr. Sridharakumar Narasimhan is an Assistant Professor at the Department of Chemical Engineering, IIT Madras. He received his M.Tech (Integrated course) degree in Chemical Engineering from IIT Bombay and started his graduate studies in Chemical Engineering and obtained his PhD from Clarkson University in 2006. From 2006–2008 he was a post-Doctoral Scholar in the department of Chemical Engineering, NTNU, Trondheim, Norway. His research interests are in process operations (control, fault diagnosis), system identification and optimization.</p><h3><strong>2. Why Learn Linear Algebra?</strong></h3><p>A data set is typically represented as the NxD matrix where N is the number of observations and D is the number of dimensions and is usually large. As human beings tend to visualize only up to 3 dimensions, linear algebra helps us to extend our observations on smaller dimensions to larger dimensions.</p><p>For example, the image can be represented pixel by pixel in a matrix format. Linear algebra is also largely employed in solving the system of linear equations.</p><h3><strong>3. Vectors And Matrices</strong></h3><p>Vector is a quantity having magnitude and direction that determines the position of a point in space relative to another. It can be used to represent individual data points in the data set.</p><p>2D Representation: A vector v(1,2) in XY axes. Here the X component of the vector ‘v’ is 1 and Y component of ‘v’ is 2.</p><p>Matrix can be referred as a vector of vectors usually in the order of NxD.</p><h3><strong>4. Properties of vectors:</strong></h3><p>The vector space should satisfy the following properties:</p><p><strong>a) Scalar multiplication:</strong></p><p>It is nothing but multiplying a number and multiply with every element of a matrix. The resultant vector will be collinear with the old vector.</p><p><strong>b) Vector addition:</strong></p><p>Two or more vectors are added and the resultant sum is a vector. Every element of a matrix in the same row will be added to get a resultant element.</p><h3><strong>5. Vector Operations</strong></h3><p><strong>a) Distance Between Two Vectors</strong></p><p>Let us consider two vectors P(x1, y1) and Q(x2, y2) in the two dimensional vector space. The distance between them can be computed using the Pythagoras theorem. It states that the square of the hypotenuse (the side opposite the right angle) is equal to the sum of the squares of the other two sides in the right angled triangle.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/389/1*C0j5MQKcDVFakugPLrkvpA.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/374/1*HsHA-pDvKI_jcJfr_8keFw.jpeg" /></figure><p><strong>b) Dot Product</strong></p><p>The dot product is an operation that takes two vectors as input, and that returns a scalar number as output. The number returned is dependent on the length of both vectors, and on the angle between them. The dot product of two vectors a = [a1, a2, …, an] and b = [b1, b2, …, bn] is defined as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/219/1*wLJfRtOzGU13wTULgpN4Zg.jpeg" /></figure><p><strong>c)</strong> <strong>Scalar Projection</strong></p><p>The scalar projection (or scalar component) of a Euclidean vector a in the direction of a Euclidean vector b is given by:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/189/1*3LN79bWeC2OSCQv0E35MBw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*f91vr-lxMAg1ThDMQeH6xA.png" /></figure><h3><strong>6) Linear combination of vectors:</strong></h3><p>It can be expressed as a combination of the two properties of vector space.</p><p>y=α1x1 + α2x2 + α3x3 +…..+ αnxn</p><p>We can find whether the vector is linearly independent or not with the help of above equation.</p><p>But, wait! What is meant by linearly independent vectors? It is said that if the vector is linearly independent, it cannot be written in above form ( as a linear combination of vectors) It is not as easy as it seems to be. There are number of equations in this world which seem to be linearly independent but it is actually linearly dependent. There are some easy ways to say the vector is linearly independent,</p><p>α1 = α2 = …….. = αn = 0</p><p>When we write those vectors in matrix form, det(matrix) ≠ 0</p><p><em>Quick fact:</em> Determinant of vectors of a 2D matrix represents the area enclosed by those vectors and volume is represented by vectors of 3D matrix.</p><h3><strong>7. Matrix Rank:</strong></h3><p><strong>Row rank: </strong>Number of linearly independent rows.</p><p><strong>Column rank:</strong> Number of linearly independent columns.</p><p>Row rank ≤ number of rows in a matrix</p><p>Column rank ≤ number of column in a matrix</p><p>Wondering why rank intrude in between, actually dependency of vectors can also be found using rank of matrix formed by the vectors.</p><p>When the equation is in the form of Ax=B,</p><blockquote>Solutions are unique if rank(A) = rank([AB])</blockquote><blockquote>Infinitely many solutions if rank(A) = rank([AB])</blockquote><blockquote>No solution if rank(A) &lt; rank([AB])</blockquote><h3><strong>8. Types Of Matrices:</strong></h3><p>Matrices can be used effectively to solve a system of linear equations in a simpler way. The order of increasing difficulty in solving the system of equations is as follows:</p><p><strong>a)</strong> <strong>Diagonal Matrix:</strong></p><p>A matrix that has data entries only on the main diagonal (left diagonal), and all the other values of the matrix is zero is called a diagonal matrix. Unlike other matrices, one could visibly solve the equations that are represented in the form of a diagonal matrix.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/318/1*JSb5rV2J1tHr0tWoJrMs8A.png" /></figure><p><strong>b)</strong> <strong>Lower Triangular matrix:</strong></p><p>A matrix that has data entries all over the lower triangle of the matrix i.e. all the points below the main diagonal has some value and all other entries in the matrix is zero, is called a Lower Triangular matrix. The system of linear equations can be solved through a method known as the ‘Forward Sweep’.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/244/1*Inf6ys9LHWSh0HduQWhYMQ.png" /></figure><p><strong>c) Upper Triangular matrix:</strong></p><p>A matrix that has data entries all over the upper triangle of the matrix .i.e all the points above the main diagonal has some value and all other entries in the matrix is zero, is called an Upper Triangular matrix. The system of linear equations can be solved through a method similar to the ‘Forward sweep’ in the backward direction known as ‘Backward Sweep’.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/244/1*PQAfuPxQgjb5gu3GFtAe-g.jpeg" /></figure><p><strong>d) Any other matrix:</strong></p><p>A matrix that has entries all over the matrix is the toughest to solve the system of linear equations. It has various methods to solve but is usually a time consuming process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/369/1*HLOkOrZqKkqqG9DY3vx0Yg.png" /></figure><h3><strong>9. Solving system of Linear Equations:</strong></h3><p><strong>a) Gauss elimination:</strong></p><p>It is a method of solving linear equations by eliminating some of the elements of a matrix and creating either lower or upper diagonal matrix so that the bottom or top of the matrix will exactly have one variable in the linear equation, the last but one have two variable and so on. The equations are solved with the help of solutions got from previous equation.</p><p><strong>b) LU Decomposition:</strong></p><p>LU Decomposition technique is one of the most common and easy way to solve the system of linear equations. One would appreciate this method of solving the equations when coding algorithms to solve the equations. L U decomposition of a matrix is the factorization of a given square matrix into two triangular matrices, one upper triangular matrix and one lower triangular matrix, such that the product of these two matrices gives the original matrix. This method comes in handy to solve same set of equations with only the constant term changing.</p><p><strong>Steps in L U Decomposition:</strong></p><p>1. Factorize the given square matrix into LU such that L is a lower triangular matrix and U is an upper triangular matrix.</p><p>2. Solve for y in Ly = b.</p><p>3. Solve for x in Ux=y</p><p>X is the required solution of the equation Ax = b. The main advantage of this method is that for any matrix if we can find the factors L and U, for any value ‘b’ we could easily solve the equations.</p><p><strong>c) Q R Factorization:</strong></p><p><strong>Orthogonal vectors:</strong></p><p>Two vectors are said to be orthogonal if the are perpendicular to each other. That is their dot product is equal to zero.</p><p><strong>Orthonormal vectors:</strong></p><p>Orthogonal vectors that have an unit magnitude is called orthonormal vectors.</p><p>This process is also called as the ‘Gram Schmidt process’. It involves in factorization of a matrix in the form Q R where Q is the orthonormal matrix .i.e that is all the vectors are perpendicular to each other and have a unit magnitude. R is an upper triangular matrix that has the dot product of the row vectors of the A matrix and the column vectors of the Q matrix.</p><p><strong>Least Squares:</strong></p><p>The shortest distance between any two vectors is the perpendicular distance between them. When a matrix is over-determined .i.e when the number of equations are more than the unknowns, a unique solution can not be found all the time. In such cases, we more often get what is called the ‘Best Estimated solution’ with the method known as least Squares.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/286/1*jwaqWwVGYa7B8KrwqwysiA.png" /></figure><p>For the system A x = b ,the least squares formula is obtained from the problem ,</p><p>min x ‖ A x − b ‖ , the solution of which can be written with the normal equations,</p><p>x = ( A ^T A ) ^− 1 A^ T b</p><h3><strong>10. Eigen Values And Eigen Vectors:</strong></h3><p>A vector that does not get rotated after undergoing a matrix transformation is called EigenVector. Eigenvalues and eigenvectors are particularly useful when finding the nth degree of a matrix. If S is a matrix containing all the eigenvector and /\ be a diagonal matrix that contains all the eigenvalues as the entries of the diagonal elements, then we can prove that,</p><p>A^n = S /\^n S^-1</p><p>If the matrix is symmetric all eigenvalues are real, distinct and always independent. They are perpendicular to each other. In a singular matrix at least one eigenvalue is zero.</p><h3>11. Tutorial</h3><p>Its the time to verify your learning! Solve the problems in <a href="https://drive.google.com/open?id=0B1ZJ3tFq0xSiZGczWW9YY0hJYlBGWUZvcHBVUHRhdE5OZFVv">this link.</a></p><p>We referred some great contents from Wikipedia and Applied AI course for this write up. Thanks!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9afff5d6b51f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Haberman’s Cancer Survival: Visual Exploratory Data Analysis using Python]]></title>
            <link>https://medium.com/@gokulkarthikk/habermans-cancer-survival-visual-exploratory-data-analysis-using-python-e7dcb7ac01ed?source=rss-fcbd78e83361------2</link>
            <guid isPermaLink="false">https://medium.com/p/e7dcb7ac01ed</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[cancer]]></category>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Gokul]]></dc:creator>
            <pubDate>Fri, 09 Mar 2018 05:15:45 GMT</pubDate>
            <atom:updated>2018-03-09T05:15:45.085Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://www.kaggle.com/gokulkarthik/haberman-s-survival-exploratory-data-analysis">Haberman&#39;s Survival: Exploratory Data Analysis</a></p><p>Exploratory Data Analysis (EDA) is the series of asking questions and applying statistics and visualization techniques to answer those questions and to uncover the hidden insights from the data. A case study on the cancer survival data set is done to explore the most common EDA techniques in this blog.</p><h3>0. Data Description</h3><p>The Haberman’s survival data set contains cases from a study that was conducted between 1958 and 1970 at the University of Chicago’s Billings Hospital on the survival of patients who had undergone surgery for breast cancer.</p><p><strong>Attribute Information:</strong></p><ol><li>Age of patient at time of operation (numerical)</li><li>Patient’s year of operation (year — 1900, numerical)</li><li>Number of positive auxillary nodes detected (numerical)</li><li>Survival status (class attribute) 1 = the patient survived 5 years or longer 2 = the patient died within 5 years</li></ol><p>Setting the objective is the key in EDA which will structure your thoughts in the entire analysis. Here the objective is to predict whether the patient will survive after 5 years or not based upon the patient’s age, year of treatment and the number of positive lymph nodes.</p><h3>1. Environment Configuration</h3><p>Import the required packages and load the data set.</p><pre>import numpy as np<br>import pandas as pd<br>import matplotlib.pyplot as plt<br>import seaborn as sns<br>sns.set()</pre><pre>cancer_df = pd.read_csv(&#39;../input/haberman.csv&#39;, header=None, names=[&#39;age&#39;, &#39;year_of_treatment&#39;, &#39;positive_lymph_nodes&#39;, &#39;survival_status_after_5_years&#39;])<br>print(cancer_df.head())</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/825/1*OrKMZg8Jl8Z55PX1t20k8A.png" /></figure><h3>2. Data Preparation</h3><pre>print(cancer_df.info())</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/827/1*Q_mdYSVXIzbXbXEyeY-9Ng.png" /></figure><p><strong>Observations:</strong></p><ul><li>There are no missing values in this data set. So there is no need to do data imputation.</li><li>The datatype of ‘survival_status_after_5_years’ column is integer. It has to be converted to categorical datatype.</li><li>The values of ‘survival_status_after_5_years’ column are not meaningful. Hence they are mapped to ‘yes’ (survived after 5 years) and ‘no’ (not survived after 5 years</li></ul><p>Check the unique values of the target column. Modify the target column values to be meaningful as well as categorical.</p><pre>print(list(cancer_df[&#39;survival_status_after_5_years&#39;].unique()))</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/820/1*Na8Q4KsN_39Bd3BXimBlKg.png" /></figure><pre>cancer_df[&#39;survival_status_after_5_years&#39;] = cancer_df[&#39;survival_status_after_5_years&#39;].map({1:&quot;yes&quot;, 2:&quot;no&quot;})<br>cancer_df[&#39;survival_status_after_5_years&#39;] = cancer_df[&#39;survival_status_after_5_years&#39;].astype(&#39;category&#39;)<br>print(cancer_df.head())</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/824/1*woCKfFAtbOB8xYD3BErbgw.png" /></figure><pre>print(cancer_df.info())</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/819/1*NFR5DNug3OYaZPE-B5IoXQ.png" /></figure><h3>3. High Level Statistics</h3><p>The summary statistics that describes the centrality and the dispersion are used to understand the essence of the features.</p><pre>print(cancer_df.describe())</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/822/1*2oCnhjiKlgERVtniMVpHzw.png" /></figure><pre>print(&quot;Number of rows: &quot; + str(cancer_df.shape[0]))<br>print(&quot;Number of columns: &quot; + str(cancer_df.shape[1]))<br>print(&quot;Columns: &quot; + &quot;, &quot;.join(cancer_df.columns))</pre><pre>print(&quot;Target variable distribution&quot;)<br>print(cancer_df.iloc[:,-1].value_counts())<br>print(&quot;*&quot;*50)<br>print(cancer_df.iloc[:,-1].value_counts(normalize = True))</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/820/1*qNt-LKjRgSMKCBwhjUYqog.png" /></figure><p><strong>Observations:</strong></p><ul><li>The age of the patients vary from 30 to 83 with the median of 52.</li><li>Although the maximum number of positive lymph nodes observed is 52, nearly 75% of the patients have less than 5 positive lymph nodes and nearly 25% of the patients have no positive lymph nodes</li><li>The data set contains only a small number of records (306).</li><li>The target column is imbalanced with 73% of values are ‘yes’</li></ul><h3>4. Uni variate Analysis</h3><p>The major purpose of the uni variate analysis is to describe, summarize and find patterns in the single feature.</p><p><strong>4.1. Distribution plots</strong></p><p>Distribution plots are used to visually assess how the data points are distributed with respect to its frequency.<br>* Usually the data points are grouped into bins and the height of the bars representing each group increases with increase in the number of data points <br>lie within that group. (histogram)<br>* Probability Density Function (PDF) is the probability that the variable takes a value x. (smoothed version of the histogram)<br>* Kernel Density Estimate (KDE) is the way to estimate the PDF. The area under the KDE curve is 1.<br>* Here the height of the bar denotes the percentage of data points under the corresponding group.</p><pre>for idx, feature in enumerate(list(cancer_df.columns)[:-1]):<br>    fg = sns.FacetGrid(cancer_df, hue=&#39;survival_status_after_5_years&#39;, size=5)<br>    fg.map(sns.distplot, feature).add_legend()<br>    plt.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/477/1*ocJ-XB21RdcGknY4w_1XWQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/490/1*OSHayUQGPJVEYarm1-sblA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/497/1*BEYRQSor84p9d5Yp07AesQ.png" /></figure><p><strong>4.2. CDF</strong></p><p>The cumulative distribution function (cdf) is the probability that the variable takes a value less than or equal to x.</p><pre>plt.figure(figsize=(20,5))<br>for idx, feature <strong>in</strong> enumerate(list(cancer_df.columns)[:-1]):<br>    plt.subplot(1, 3, idx+1)<br>    print(&quot;********* &quot;+feature+&quot; *********&quot;)<br>    counts, bin_edges = np.histogram(cancer_df[feature], bins=10, density=True)<br>    print(&quot;Bin Edges: <strong>{}</strong>&quot;.format(bin_edges))<br>    pdf = counts/sum(counts)<br>    print(&quot;PDF: <strong>{}</strong>&quot;.format(pdf))<br>    cdf = np.cumsum(pdf)<br>    print(&quot;CDF: <strong>{}</strong>&quot;.format(cdf))<br>    plt.plot(bin_edges[1:], pdf, bin_edges[1:], cdf)<br>    plt.xlabel(feature)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/832/1*PBsaB2VzBXDJT5zTWXUHWA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/838/1*G4nUPmYUB3dTXGmZlQL78w.png" /></figure><p><strong>4.3. Box Plots</strong></p><p>Box plot takes a less space and visually represents the five number summary of the data points in a box. <br>The outliers are displayed as points outside the box.<br>1. Q1–1.5*IQR<br>2. Q1 (25th percentile)<br>3. Q2 (50th percentile or median)<br>4. Q3 (75th percentile)<br>5. Q3 + 1.5*IQR<br>Inter Quartile Range = Q3 -Q1</p><pre>fig, axes = plt.subplots(1, 3, figsize=(15, 5))<br>for idx, feature <strong>in</strong> enumerate(list(cancer_df.columns)[:-1]):<br>    sns.boxplot( x=&#39;survival_status_after_5_years&#39;, y=feature, data=cancer_df, ax=axes[idx])<br>plt.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/835/1*5PeG2jAOn9TZ2HdSMSJWmA.png" /></figure><p><strong>4.4. Violin Plots</strong></p><p>Violin plot is the combination of box plot and probability density function.</p><pre>fig, axes = plt.subplots(1, 3, figsize=(15, 5))<br>for idx, feature <strong>in</strong> enumerate(list(cancer_df.columns)[:-1]):<br>    sns.violinplot( x=&#39;survival_status_after_5_years&#39;, y=feature, data=cancer_df, ax=axes[idx])<br>plt.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/839/1*dlLAJ_R1x-1wJG14baaC9w.png" /></figure><p><strong>Observations</strong></p><ul><li>The number of positive lymph nodes of the survivors is highly dense from 0 to 5. (#4.1)</li><li>Almost 80% of the patients have less than or equal to 5 positive lymph nodes. (#4.2)</li><li>The patients treated after 1966 have the slightly higher chance to survive that the rest. The patients treated before 1959 have the slightly lower chance to survive that the rest. (#4.3 and #4.4)</li></ul><h3>5. Multivariate Analysis</h3><p>The analysis of the relationship between multiple variables and its effect on the target class is known as multi variate analysis.</p><p>Pair plot is commonly used to visualize the relationship between Quantitative and Quantitative columns. As all the independent columns in our data set are quantitative, use the pair plot.</p><p>Pair plot in seaborn plots the scatter plot between every two data columns in a given data frame. It is used to visualize the relationship between two variables.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/994/1*s0dweU7HuJY3J1GJODDyDA.png" /></figure><p><strong>Observations</strong></p><p>By scattering the data points between <em>year_of_treatment</em> and <em>positive_lymph_nodes</em>, we can see the better seperation between the two clases than other scatter plots.</p><p>If you like this EDA tutorial, please up vote my kaggle kernel at <a href="https://www.kaggle.com/gokulkarthik/haberman-s-survival-exploratory-data-analysis">https://www.kaggle.com/gokulkarthik/haberman-s-survival-exploratory-data-analysis</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e7dcb7ac01ed" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Data Science Learning Path]]></title>
            <link>https://medium.com/@gokulkarthikk/data-science-learning-path-dc17deae9e7a?source=rss-fcbd78e83361------2</link>
            <guid isPermaLink="false">https://medium.com/p/dc17deae9e7a</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[statistics]]></category>
            <category><![CDATA[social-network-analysis]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[data-analysis]]></category>
            <dc:creator><![CDATA[Gokul]]></dc:creator>
            <pubDate>Fri, 10 Nov 2017 16:29:09 GMT</pubDate>
            <atom:updated>2017-11-10T16:29:09.467Z</atom:updated>
            <content:encoded><![CDATA[<p>In this century of digital word, data are growing exponentially. The Multi National Corporations harness these data to learn about the people and to improve customer experience. The governments also begin to use data for<br>policy framing and decision making. Most of such real world data are in the unstructured format and ultimately the organizations need <em>Data Scientists</em> to derive insights.<br>The problem of getting started in data science is not because of the lack of resources but the plenty of them. So I have collected better resources for learning data science. If you are a beginner and want to<br>become a ‘real’ data scientist, follow this learning path religiously.</p><h3>Step 1 : Mathematical Foundations</h3><h4>Probability:</h4><blockquote>1.1 “Introduction to probability — The science of uncertainty” on edX is an excellent course to learn concepts of probability like conditional probability and probability distributions.</blockquote><h4>Statistics:</h4><blockquote>1.2 “Descriptive Statistics” and “Inferential Statistics” from Udacity are the must do courses to get started.</blockquote><h4>Linear Algebra:</h4><blockquote>1.3 “Linear Algebra” : This concise and an excellent course on Khan Academy will equip you with the skills necessary for Data Science and Machine Learning.</blockquote><h3>Step 2 : Learn (Python | R) | (Python &amp; R)</h3><h4>Python:</h4><blockquote>2.1 Begin with “CodeAcademy”<br>2.2 “Intro to Python for Data Science” — An interactive course developed by DataCamp.<br>2.3 Take Google class on Python and solve exercises(YouTube)</blockquote><h4>R:</h4><blockquote>2.4 “Interactive Intro to R Programming Language” — An excellent course by DataCamp to give you hands-on experience in R. The course includes interactive examples. You will never feel bored while learning R.</blockquote><h3>Step 3 : Data Exploration and Visualization:</h3><h4>Python:</h4><blockquote>3.1 “Applied Plotting, Charting and Data Visualization” by the University of Michigan on Coursera.<br>3.2 “Intro to Data Analysis” — An excellent course by Udacity on Data Exploration using Numpy and Pandas.</blockquote><h4>R</h4><blockquote>3.3 “Exploratory Data Analysis” — An awesome course by Johns Hopkins University on Coursera.<br>You will need no other course to perform visualization and exploratory work in R.</blockquote><h3>Step 4 : Machine Learning</h3><blockquote>4.1 “Machine Learning” by Andrew Ng — No captions required!</blockquote><h4>Python:</h4><blockquote>4.2 “Applied Machine Learning in python” by the University of Michigan on Coursera.</blockquote><h4>R</h4><blockquote>4.3 “Machine Learning” by John Hopkins University on Coursera.</blockquote><h3>Step 5 : Specialization</h3><h4>a) Deep Learning</h4><blockquote>5.1 “Deep learning” by Google atUdacity — This is an excellent basic course on transition from Machine Learning to Deep Learning, deep neural networks, Convolutional Neural Networks<br>and Deep Learning for texts.<br>5.2 “fast.ai” courses.</blockquote><h4>b) Text Mining</h4><blockquote>5.3 “cs224w” by Stanford University.</blockquote><blockquote>5.4 “Applied Text Mining in Python” by the University of Michigan on Coursera.</blockquote><h4>c) Social Network Analysis</h4><blockquote>5.5 “Social Networks” by Prof. Sudharshan at NPTEL.<br>5.6 “Applied Social Network Analysis in Python” by the University of Michigan at Coursera.<br>5.7 “Crowds, Networks and Markets” at edX.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dc17deae9e7a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GitHub Social Network Analysis]]></title>
            <link>https://medium.com/@gokulkarthikk/github-social-network-analysis-28f72b2f5e3?source=rss-fcbd78e83361------2</link>
            <guid isPermaLink="false">https://medium.com/p/28f72b2f5e3</guid>
            <category><![CDATA[social-network-analysis]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[programming-languages]]></category>
            <category><![CDATA[github]]></category>
            <dc:creator><![CDATA[Gokul]]></dc:creator>
            <pubDate>Fri, 10 Nov 2017 10:45:37 GMT</pubDate>
            <atom:updated>2017-11-11T12:41:05.415Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p><strong>Social Network Analysis</strong> is the study of network behavior in social structures by leveraging the concepts in Graph Theory and Psychology. It is becoming popular in the recent times due to increasing social media usage and its applications in targeted advertisements, truth index of social posts, friendship recommendation, identification of key people and even in preventing epidemics!</p><p>In this tutorial, we will see the social network analysis on GitHub connections between people and the repositories.</p><p>Before getting into the tutorial, get motivated by this <a href="https://www.youtube.com/watch?v=tbRF_ELh0Nc">SNA 101 video</a> by Prof. Sudarshan of IIT Ropar.</p><p>Resources: “Mining the Social Web”, “Crowds, Networks and Markets”, “NPTEL: Social Networks”</p><h3>Table of Contents</h3><ol><li>Generating GitHub Access Key</li><li>Getting Started With PyGitHub</li><li>Graph Collection<br>3.1. Case Study<br>3.2. Getting Dirty With NetworkX<br>3.3. Generating Interest Graph<br>3.4. Adding Social Links<br>3.5. Adding More Repositories<br>3.6. Snapshoting The Graph</li><li>Graph Exploration<br>4.1. Popular Repositories<br>4.2. Popular Languages<br>4.3. Connectivity<br>4.4. Popular Users<br>4.5. Community Detection</li></ol><h3>1. Generating GitHub Access Key</h3><p>Like other social networking sites Twitter and Facebook, GitHub also has <strong>GitHub API v3</strong> which could be used to used to extract much useful information. Information like followers, starred repositories, the programming language of the repositories and much more can be fetched using this API.</p><p>We need an access key to use this API. Follow the steps to get the access key.</p><ol><li>Login github.com</li></ol><p>2. Go to Settings -&gt; Developer settings -&gt; Personal access tokens</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j9FgQRWsin7LXKHAwLFfEg.png" /></figure><p>3. Click on Generate New Token</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Vs9QDXENGCmgqokfJifLag.png" /></figure><p>4. Check the repo box and fill the description.</p><p>5. Generate token</p><p>Don’t forget to note down the token locally as it will not be accessible via the website next time.</p><h3>2. Getting Started With PyGitHub</h3><p><strong>PyGitHub</strong> is the wrapper library over GitHub API v3 and it makes our job easier!</p><p>Install it using PIP.</p><p>In [ ]:</p><blockquote><strong>pip install PyGitHub</strong></blockquote><p>It’s simple to work with PyGitHub. Just create the instance and play with the objects! Let’s see a quick code:</p><p>In [1]:</p><blockquote><strong>from github import Github<br>USER = &quot;GokulKarthik&quot;<br>PASSWD = &quot;xxxx&quot;<br>g = Github(USER, PASSWD)for repo in g.get_user().get_repos():<br>print repo.name</strong></blockquote><pre>Applied-Text-Mining-in-Python<br>Applied_Data_Science_with_Python_UMich<br>coursera-ml<br>DataEngineering-SIG<br>datasciencecoursera<br>datasharing<br>Infinity-17-NLP_Workshop<br>interview-guide<br>Mini-Projects<br>NPTEL-SocialNetworks<br>python-for-competitive-programming<br>Python-for-Data-Science-and-Machine-Learning-Bootcamp---Udemy<br>R-PAD<br>rosetta<br>Social-Networks<br>TCE-NSS-Website</pre><p>Creating the instance with the user credentials allow us to access his/her information as above.</p><h3>3. Graph Collection</h3><h4>3.1. Case Study :</h4><p>Throughout this tutorial, I am going to analyze the social network of data science learners in GitHub.</p><p>But how do we collect the graph? In <a href="https://www.youtube.com/watch?v=bXYVCdUvjeI&amp;index=10&amp;list=PL3DBHamkNmfcv11sQwQj1fCFkMbEQIAWY">this</a> NPTEL video, Prof. Sudarshan beautifully explains the concept of “Collecting Web Graph by random walk”.</p><p>GitHub is a very large network and we need GPUs and graph database to work with such a large dataset. So we are going to take the sample network data of data science learners community.</p><p>Then comes another problem! From which node I have to start? The answer is ‘any’. But if we start from the popular data science resource/tutorial repository, we can easily capture more information about the data science learning community. Google page rank suggested me to start with “Awesome Datascience” github repository by Bulut Yazılım.</p><h3>3.2. Getting Dirty With Networkx</h3><p>NetworkX is the graph computing library in python. We can easily create the graph using networkX by reading graph files like gexf, gml, graphml, pajek net or by simply adding nodes and edges.</p><p>Install it using pip</p><p>In [ ]:</p><blockquote><strong><em>pip install networkx</em></strong></blockquote><blockquote><strong><em>#importing the package</em><br>import networkx as nx<br><br><em>#Creating the NULL graph</em><br>G1 = nx.Graph()<br><br><em>#Adding the edges will automatically add the nodes</em><br>G1.add_edges_from([(1,2), (2,3), (3,4)])<br><br><em>#Visulazing using matplotlib</em><br>import matplotlib.pyplot as plt<br>nx.draw(G1, with_labels=True)<br>plt.show()</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/472/1*T7zcJ5RscuSt4WKfKNZt2Q.png" /></figure><p>In [14]:</p><blockquote><strong><em>#Creating the directed graph</em><br>G2 = nx.DiGraph([(1,2), (2,3), (3,4)])<br>nx.draw(G2, with_labels=True)<br>plt.show()</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/472/1*Urrpy3MIcOhk9GImg2GUuw.png" /></figure><p>In [15]:</p><blockquote><strong><em>#modelling road network</em><br>G3 = nx.Graph()<br>cities = [&#39;Delhi&#39;, &#39;Madurai&#39;, &#39;Mumbai&#39;, &#39;Tuticorin&#39;, &#39;Chennai&#39;, &#39;Kochi&#39;, &#39;Hyderabad&#39;, &#39;Ropar&#39;]<br>for city in cities:<br> G3.add_node(city)<br>nx.draw(G3, with_labels=1)<br>plt.show()</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/472/1*WDy-XTDdsZ2C85FXqF6WIg.png" /></figure><p>In [20]:</p><blockquote><strong>import random as rd <br><br><em>#Addding 20 edges to the graph</em><br>while(G3.number_of_edges() != 10):<br> city1 = rd.choice(G3.nodes())<br> city2 = rd.choice(G3.nodes())<br> <em>#selecting random costs</em><br> wt = rd.randint(20, 2000)<br> if city1 != city2 and G3.has_edge(city1, city2) == 0:<br> G3.add_edge(city1, city2, weight = wt)<br><br>pos = nx.circular_layout(G3)<br>nx.draw(G3, pos, with_labels=1)<br>nx.draw_networkx_edge_labels(G3, pos)<br>plt.show()</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/472/1*yZu-ImNqad1Hyu0HW-YdEA.png" /></figure><p>In [23]:</p><blockquote><strong><em># Getting the shortest path </em><br>print nx.dijkstra_path(G3, &#39;Mumbai&#39;, &#39;Tuticorin&#39;)</strong></blockquote><pre>[&#39;Mumbai&#39;, &#39;Hyderabad&#39;, &#39;Madurai&#39;, &#39;Ropar&#39;, &#39;Tuticorin&#39;]</pre><h3>3.3. Generating Interest Graph</h3><p>The interest graph is generated by making connections to the object which people are interested in. Here objects are the repositories. As I already stated let us build a star graph by making edges to the repository “AwesomeDataScience” with the people who starred it. Its schema is displayed below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/350/1*z0HM19lKz-51Qe30SEl_XA.png" /></figure><p>In [1]:</p><blockquote><strong><em># Python code for finding the people who followed the &quot;awesome-datascience&quot; repository</em><br>…<br>print &quot;Number of stargazers :&quot;, len(stargazers)</strong></blockquote><pre>Number of stargazers : 4747</pre><p>In [2]:</p><blockquote><strong>print stargazers[:15]</strong></blockquote><pre>[NamedUser(login=&quot;sakkas45&quot;), NamedUser(login=&quot;ogta&quot;), NamedUser(login=&quot;necatikartal&quot;), NamedUser(login=&quot;gwn&quot;), NamedUser(login=&quot;musaulker&quot;), NamedUser(login=&quot;bahattincinic&quot;), NamedUser(login=&quot;mahammad&quot;), NamedUser(login=&quot;kurtulusahmet&quot;), NamedUser(login=&quot;onuryurtturk&quot;), NamedUser(login=&quot;nicolasramy&quot;), NamedUser(login=&quot;GarethLewin&quot;), NamedUser(login=&quot;qs&quot;), NamedUser(login=&quot;Jberlinsky&quot;), NamedUser(login=&quot;jt6211&quot;), NamedUser(login=&quot;erolrecep&quot;)]</pre><p>In [3]:</p><blockquote><strong><em># Python code for creating an interest graph with stargazers</em><br>…<br>print nx.info(G)</strong></blockquote><pre>Name: <br>Type: DiGraph<br>Number of nodes: 4748<br>Number of edges: 4747<br>Average in degree:   0.9998<br>Average out degree:   0.9998</pre><h3>3.4. Adding Social Links</h3><p>The connections between the people in the graph can be established by extracting the followers. If a person follows another person within this group, we add an edge.(Similar to a random walk) The schema for this graph is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/342/1*g_MHmLlWj3nRN6SFNG1s8g.png" /></figure><p>In [4]:</p><blockquote><strong># Python code for adding social links</strong></blockquote><blockquote><strong>…</strong></blockquote><blockquote><strong>print &quot;Processed&quot;, i+1, &quot; stargazers&quot;<br> print &quot;Number of nodes and edges in the graph&quot;,G.number_of_nodes(), &quot;and&quot;, G.number_of_edges()</strong></blockquote><pre>Processed 1  stargazers<br>Number of nodes and edges in the graph 4748 and 4756<br>Processed 2  stargazers<br>Number of nodes and edges in the graph 4748 and 4775<br>Processed 3  stargazers<br>Number of nodes and edges in the graph 4748 and 4789<br>Processed 4  stargazers<br>Number of nodes and edges in the graph 4748 and 4790<br>...</pre><p>Note: As it is a very time consuming process, I have limited the number of stargazers to process.</p><p>In [5]:</p><blockquote><strong>print nx.info(G)</strong></blockquote><pre>Name: <br>Type: DiGraph<br>Number of nodes: 4748<br>Number of edges: 6486<br>Average in degree:   1.3660<br>Average out degree:   1.3660</pre><h3>3.5. Adding More Repositories</h3><p>We are going to analyze the behavior of the people in this network.(What are the non data science languages that are popular among the stargazers of “awesome data science” repository?) For that, let us add information about the repositories that people in this group follow. This will increase the nodes and edges in the graph.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/343/1*5BSLOPykX0qNUi0v7cSq_w.png" /></figure><p>In [6]:</p><blockquote><strong>print G.nodes()</strong></blockquote><pre>[u&#39;grekuna&#39;, u&#39;jw3&#39;, u&#39;devottam&#39;, u&#39;DaveRKelly&#39;, u&#39;atomicnumber1&#39;, u&#39;sharma-abhi&#39;, u&#39;sashashakun&#39;, u&#39;AkmKawser&#39;, u&#39;tharun139&#39;, u&#39;Galmido&#39;, u&#39;ezeql&#39;, u&#39;otw1248&#39;, u&#39;MishinVD&#39;, u&#39;amandeepmittal&#39;, u&#39;neeshykha&#39;, u&#39;devcsrj&#39;, u&#39;mathewlee11&#39;, u&#39;zhiyue&#39;, u&#39;hetysh&#39;, u&#39;leorassi&#39;, u&#39;mimr9&#39;, u&#39;nickdandakis&#39;, u&#39;sohomghosh&#39;, u&#39;glennmatlin&#39;, u&#39;tscholak&#39;, u&#39;wujunwei928&#39;, u&#39;skrishnan22&#39;, u&#39;lorn&#39;, u&#39;elicul&#39;, u&#39;ketankhairnar&#39;, u&#39;michaeltomko&#39;, <br>...</pre><blockquote><strong># Python code for adding more repositories</strong></blockquote><blockquote><strong>…<br> print &quot;Processed&quot;, i+1, &quot; stargazers&quot;<br> print &quot;Number of nodes and edges in the graph&quot;,G.number_of_nodes(), &quot;and&quot;, G.number_of_edges()<br> print &quot;-&quot;*100</strong></blockquote><pre>Processed 1  stargazers<br>Number of nodes and edges in the graph 4750 and 6488<br>----------------------------------------------------------------------------------------------------<br>Processed 2  stargazers<br>Number of nodes and edges in the graph 4950 and 6688<br>...</pre><p>Note: As it is a very time consuming process, I have limited the number of stargazers to process.</p><p>In [8]:</p><blockquote><strong>print(nx.info(G))</strong></blockquote><pre>Name: <br>Type: DiGraph<br>Number of nodes: 23768<br>Number of edges: 35843<br>Average in degree:   1.5080<br>Average out degree:   1.5080</pre><h3>3.6. Snapshoting The Graph</h3><p>Snapshoting the graph can help us to reuse it and we don’t need to make API calls through PyGitHub everytime.</p><p>It can be done either by saving the graph as graphical data formats like graphml, gml, gexf or by pickling. Pickling is the process of serializing the python object into a byte stream, which can be deserialized<br> to retrieve the graph.</p><p>In [11]:</p><blockquote><strong><em># Pickling</em><br>nx.write_gpickle(G, &quot;github_1.pickle&quot;)<br><em># G1 = nx.read_gpickle(&quot;github_1.pickle&quot;)</em></strong></blockquote><blockquote><strong><em># Exercise: saving as graphml (Modify the Node type with &#39;None&#39; as it cannot be saved as graphml file) </em><br><em># nx.write_gml(G, &quot;github_1.gml&quot;)</em><br><em># G1 = nx.read_gml(&quot;github_1.gml&quot;)</em></strong></blockquote><p>In [10]:</p><blockquote><strong>import networkx as nx<br>G1 = nx.read_gpickle(&quot;github_1.pickle&quot;)<br>print nx.info(G1)</strong></blockquote><pre>Name: <br>Type: DiGraph<br>Number of nodes: 23768<br>Number of edges: 35843<br>Average in degree:   1.5080<br>Average out degree:   1.5080</pre><p>The snapshot dataset is available at <a href="https://github.com/GokulKarthik/Mini-Projects/tree/master/Analysing%20Data%20Science%20Learners%20On%20GitHub">this link.</a></p><h3>4. Graph Exploration</h3><h3>4.1. Popular Repositories</h3><p><strong>Idea:</strong> The repository nodes with many high in-degree are the popular ones. As we started with the ‘awesome-datascience’ repository and added only some other repositories, there is a great probability that this repository tops this list. Let us find!</p><p>In [12]:</p><blockquote><strong>print &quot;Most popular repositories&quot;<br>#Python code for finding the popular repositories</strong></blockquote><blockquote><strong>…<br>print sorted_repos_degree[:20]</strong></blockquote><pre>Most popular repositories<br>[(u&#39;awesome-datascience&#39;, 4747), (u&#39;awesome-machine-learning&#39;, 34), (u&#39;go&#39;, 34), (u&#39;every-programmer-should-know&#39;, 34), (u&#39;awesome&#39;, 33), (u&#39;tensorflow&#39;, 33), (u&#39;dotfiles&#39;, 32), (u&#39;coding-interview-university&#39;, 29), (u&#39;awesome-python&#39;, 28), (u&#39;free-programming-books&#39;, 27), (u&#39;system-design-primer&#39;, 27), (u&#39;awesome-awesomeness&#39;, 25), (u&#39;awesome-bigdata&#39;, 23), (u&#39;papers-we-love&#39;, 22), (u&#39;awesome-public-datasets&#39;, 22), (u&#39;the-art-of-command-line&#39;, 21), (u&#39;machine-learning-for-software-engineers&#39;, 21), (u&#39;public-apis&#39;, 21), (u&#39;models&#39;, 20), (u&#39;thefuck&#39;, 20)]</pre><h3>4.2. Popular Languages</h3><p><strong>Idea:</strong> The weights of the repository nodes can be used to find the popular languages. The repository node attribute ‘lang’ is used and the in degree of that node is used for adding weight. (Each in-edge increments the weight by one)</p><p>In [13]:</p><blockquote><strong>#Python code for finding the languages used</strong></blockquote><blockquote><strong>…<br>print languages_score</strong></blockquote><pre>{u&#39;TypeScript&#39;: 0, u&#39;Objective-C++&#39;: 0, u&#39;Lean&#39;: 0, u&#39;Fortran&#39;: 0, u&#39;Jupyter Notebook&#39;: 0, u&#39;Groff&#39;: 0, u&#39;Shell&#39;: 0, u&#39;Web Ontology Language&#39;: 0, u&#39;AppleScript&#39;: 0, u&#39;Elm&#39;: 0, u&#39;SuperCollider&#39;: 0, u&#39;Nginx&#39;: 0, u&#39;Elixir&#39;: 0, u&#39;PostScript&#39;: 0, u&#39;Thrift&#39;: 0, u&#39;Logos&#39;: 0, u&#39;D&#39;: 0, u&#39;Kotlin&#39;: 0, u&#39;Crystal&#39;: 0, u&#39;Objective-C&#39;: 0, u&#39;Batchfile&#39;: 0, u&#39;Objective-J&#39;: 0, u&#39;Roff&#39;: 0, u&#39;FreeMarker&#39;: 0, u&#39;Swift&#39;: 0, u&#39;Smarty&#39;: 0, u&#39;Arc&#39;: 0, u&#39;Go&#39;: 0, u&#39;Visual Basic&#39;: 0, u&#39;PHP&#39;: 0, u&#39;Coq&#39;: 0, u&#39;Java&#39;: 0, u&#39;Scala&#39;: 0, u&#39;OpenSCAD&#39;: 0, u&#39;ApacheConf&#39;: 0, u&#39;Makefile&#39;: 0, u&#39;Perl&#39;: 0, u&#39;Lua&#39;: 0, u&#39;GDScript&#39;: 0, u&#39;Verilog&#39;: 0, u&#39;Haxe&#39;: 0, u&#39;Red&#39;: 0, u&#39;WebAssembly&#39;: 0, u&#39;CoffeeScript&#39;: 0, u&#39;HTML&#39;: 0, u&#39;Awk&#39;: 0, u&#39;Lex&#39;: 0, u&#39;Idris&#39;: 0, u&#39;Ruby&#39;: 0, u&#39;PLpgSQL&#39;: 0, u&#39;C&#39;: 0, u&#39;AutoHotkey&#39;: 0, u&#39;P4&#39;: 0, u&#39;GCC Machine Description&#39;: 0, u&#39;Clojure&#39;: 0, u&#39;HCL&#39;: 0, u&#39;Prolog&#39;: 0, u&#39;CMake&#39;: 0, u&#39;Tcl&#39;: 0, u&#39;Xtend&#39;: 0, u&#39;PigLatin&#39;: 0, u&#39;GLSL&#39;: 0, u&#39;VHDL&#39;: 0, u&#39;Arduino&#39;: 0, u&#39;IDL&#39;: 0, u&#39;SQLPL&#39;: 0, u&#39;ASP&#39;: 0, u&#39;Assembly&#39;: 0, None: 0, u&#39;C#&#39;: 0, u&#39;Vala&#39;: 0, u&#39;Processing&#39;: 0, u&#39;NSIS&#39;: 0, u&#39;CSS&#39;: 0, u&#39;LiveScript&#39;: 0, u&#39;Stan&#39;: 0, u&#39;SaltStack&#39;: 0, u&#39;Protocol Buffer&#39;: 0, u&#39;QML&#39;: 0, u&#39;Mathematica&#39;: 0, u&#39;XSLT&#39;: 0, u&#39;Mask&#39;: 0, u&#39;WebIDL&#39;: 0, u&#39;TeX&#39;: 0, u&#39;R&#39;: 0, u&#39;Cuda&#39;: 0, u&#39;Vim script&#39;: 0, u&#39;Pony&#39;: 0, u&#39;Scilab&#39;: 0, u&#39;Smali&#39;: 0, u&#39;OpenEdge ABL&#39;: 0, u&#39;Perl6&#39;: 0, u&#39;M4&#39;: 0, u&#39;OCaml&#39;: 0, u&#39;Gherkin&#39;: 0, u&#39;Pascal&#39;: 0, u&#39;F#&#39;: 0, u&#39;Puppet&#39;: 0, u&#39;ActionScript&#39;: 0, u&#39;Emacs Lisp&#39;: 0, u&#39;JavaScript&#39;: 0, u&#39;VimL&#39;: 0, u&#39;Rust&#39;: 0, u&#39;Matlab&#39;: 0, u&#39;Erlang&#39;: 0, u&#39;Eagle&#39;: 0, u&#39;Scheme&#39;: 0, u&#39;PLSQL&#39;: 0, u&#39;Nim&#39;: 0, u&#39;Python&#39;: 0, u&#39;Common Lisp&#39;: 0, u&#39;Dart&#39;: 0, u&#39;XQuery&#39;: 0, u&#39;Nimrod&#39;: 0, u&#39;SystemVerilog&#39;: 0, u&#39;Groovy&#39;: 0, u&#39;Vue&#39;: 0, u&#39;M&#39;: 0, u&#39;C++&#39;: 0, u&#39;FORTRAN&#39;: 0, u&#39;ShaderLab&#39;: 0, u&#39;MoonScript&#39;: 0, u&#39;Standard ML&#39;: 0, u&#39;PureScript&#39;: 0, u&#39;Julia&#39;: 0, u&#39;PowerShell&#39;: 0, u&#39;Bro&#39;: 0, u&#39;Haskell&#39;: 0, u&#39;Racket&#39;: 0, u&#39;AGS Script&#39;: 0, u&#39;nesC&#39;: 0}</pre><p>In [14]:</p><blockquote><strong>#Python code for finding the popular languages</strong></blockquote><blockquote><strong>…<br>print languages_score_sorted[1:20] <em>#The 0th item is the None (For the repos with unidentified language)</em></strong></blockquote><pre>[(u&#39;JavaScript&#39;, 6170), (u&#39;Python&#39;, 5416), (u&#39;Java&#39;, 1920), (u&#39;Go&#39;, 1569), (u&#39;C++&#39;, 1169), (u&#39;Ruby&#39;, 1110), (u&#39;HTML&#39;, 910), (u&#39;C&#39;, 853), (u&#39;PHP&#39;, 795), (u&#39;Jupyter Notebook&#39;, 744), (u&#39;Shell&#39;, 727), (u&#39;CSS&#39;, 593), (u&#39;R&#39;, 540), (u&#39;Scala&#39;, 423), (u&#39;TypeScript&#39;, 405), (u&#39;C#&#39;, 318), (u&#39;Swift&#39;, 294), (u&#39;Objective-C&#39;, 283), (u&#39;Lua&#39;, 189)]</pre><h4>Visualizing the Top 15 languages of data science learners</h4><p>In [79]:</p><blockquote><strong>import matplotlib.pyplot as plt</strong></blockquote><blockquote><strong>#Python code for visualizing the spread of Top 15 popular languages among data science learners</strong></blockquote><blockquote><strong>…</strong></blockquote><blockquote><strong>plt.show()</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/356/1*fDh8ZGOIrU0pbLW-3kWxUQ.png" /><figcaption>Popular languages among data science learners</figcaption></figure><h3>4.3. Connectivity</h3><p>A directed graph is said to be <strong>weakly</strong> connected if there is a <strong>path</strong> between every pair of nodes in a graph.<br>A directed graph is said to be <strong>strongly</strong> connected if there is a <strong>directed path</strong> between every pair of nodes in a graph.</p><p>In [33]:</p><blockquote><strong>print nx.is_weakly_connected(G1)<br>print len(list(nx.weakly_connected_component_subgraphs(G1)))<br>print nx.is_strongly_connected(G1)</strong></blockquote><pre>True<br>1<br>False</pre><h3>4.4. Popular Users</h3><p><strong>Idea:</strong> Centrality measures identify the important nodes in a network. Each centrality measure quantifies the importance in a different way</p><p>As I have processed only a few stargazers in the network, let us make sub graph with only the user nodes that have degree &gt; 1.</p><p>In [15]:</p><blockquote><strong>#Python code for creating a sub graph H with only user nodes</strong></blockquote><blockquote><strong>…<br>print nx.info(H)</strong></blockquote><pre>Name: <br>Type: SubDiGraph<br>Number of nodes: 813<br>Number of edges: 1308<br>Average in degree:   1.6089<br>Average out degree:   1.6089</pre><h3>4.4.1. Degree Centrality</h3><p>The assumption of important nodes have many connections is made here.</p><p>In [16]:</p><blockquote><strong>#Python code for finding the popular users based on degree centrality</strong></blockquote><blockquote><strong>…<br>print dc_nodes_sorted[:10]</strong></blockquote><pre>[(u&#39;angusshire&#39;, 0.26108374384236455), (u&#39;josephmisiti&#39;, 0.13423645320197045), (u&#39;clarecorthell&#39;, 0.08374384236453201), (u&#39;sdogruyol&#39;, 0.06403940886699508), (u&#39;ibrahimgunduz34&#39;, 0.04926108374384237), (u&#39;erolrecep&#39;, 0.04926108374384237), (u&#39;jonathan-bower&#39;, 0.04926108374384237), (u&#39;hmert&#39;, 0.04926108374384237), (u&#39;RichardLitt&#39;, 0.04187192118226601), (u&#39;Ardakilic&#39;, 0.04187192118226601)]</pre><h3>4.4.2. Betweenness Centrality</h3><p>The assumption of important nodes connect other nodes is made here.</p><p>In [17]:</p><blockquote><strong>#Python code for finding the popular users based on betweenness centrality</strong></blockquote><blockquote><strong>…<br>print bc_nodes_sorted[:10]</strong></blockquote><pre>[(u&#39;bahattincinic&#39;, 0.003715609895757557), (u&#39;sly01&#39;, 0.0027998475054958256), (u&#39;muraty&#39;, 0.0025828963716568246), (u&#39;sdogruyol&#39;, 0.0022995810244569605), (u&#39;erolrecep&#39;, 0.0018606369882010257), (u&#39;smtaydemir&#39;, 0.0018147539359682438), (u&#39;kurtulusahmet&#39;, 0.001704583554725233), (u&#39;halidaltuner&#39;, 0.0016112726536821346), (u&#39;ibrahimgunduz34&#39;, 0.0015219555334538362), (u&#39;Ardakilic&#39;, 0.0012694680524224118)]</pre><h3>4.4.3. Closeness Centrality</h3><p>The assumption of important nodes close to each other is made here.</p><p>In [18]:</p><blockquote><strong>#Python code for finding the popular users based on closeness centrality</strong></blockquote><blockquote><strong>…<br>print cc_nodes_sorted[:10]</strong></blockquote><pre>[(u&#39;josephmisiti&#39;, 0.1602312119553499), (u&#39;ionelmc&#39;, 0.11593103448275863), (u&#39;mher&#39;, 0.09075620234085945), (u&#39;clarecorthell&#39;, 0.0847728811758926), (u&#39;sdogruyol&#39;, 0.0828735051959129), (u&#39;bahattincinic&#39;, 0.07150366454403459), (u&#39;ibrahimgunduz34&#39;, 0.07085559507686813), (u&#39;Ardakilic&#39;, 0.07064217460976913), (u&#39;smtaydemir&#39;, 0.0677838207238247), (u&#39;hkulekci&#39;, 0.06407978680449002)]</pre><h3>4.5. Community Detection</h3><p>Community in a social network is the sub network with more intra connectivity and less inter connectivty with other communities.<br><strong>Girvan Newman algorithm</strong> is used to detect the communities in a network. It is based on <em>edge betweenness</em>. The edges which are connecting two communities tend to have high betweenness. The algorithms detect communities by repeatedly removing the edges with high betweenness.</p><p>Let us use this community detection concept to form more than 200 groups.</p><p>In [46]:</p><blockquote><strong>def edge_to_remove(G):</strong></blockquote><blockquote><strong>…</strong></blockquote><blockquote><strong><em># Returns the edge with max betweenness</em></strong></blockquote><blockquote><strong>def girvan(G):<br> …</strong></blockquote><blockquote><strong># Return the connected components<br> print &#39;The number of connected components are &#39;, n_components<br> return components</strong></blockquote><p>In [47]:</p><blockquote><strong>communities = girvan(H)<br>for community in communities: <em>#i is a graph</em><br> print community.nodes()<br> print &quot;Number of users : &quot;, community.number_of_nodes()<br> print &quot;-&quot;*100</strong></blockquote><pre>The number of connected components are  176<br>The number of connected components are  176<br>The number of connected components are  176<br>The number of connected components are  176<br>...</pre><blockquote><strong># Python code to find the size of each group</strong></blockquote><blockquote><strong>…<br> print &quot;{} group(s) have {} user(s)&quot;.format(count, size)</strong></blockquote><pre>196 group(s) have 1 user(s)<br>1 group(s) have 610 user(s)<br>1 group(s) have 3 user(s)<br>2 group(s) have 2 user(s)</pre><p>As the data we used is a small sample and because of the process limiting due to computational dependencies, many of these 200 groups have only 1 user. This may not be the case when we work with the entire data.</p><h3>4.6 XXX</h3><p>This space is for you. Analyze and write on the comment section. Enjoy exploring!</p><h3>Bonus: Graph Visualization</h3><p>NetworkX provides basic functionality for visualizing graphs. I highly recommend you to explore the fully featured graph visualization tools like Cytospace, Gephi and GraphViz.To use other tools, export the graph into the suitable format(like we did in snapshotting the graph) and visualize it.</p><p>In [56]:</p><blockquote><strong>import matplotlib.pyplot as plt<br>plt.figure(figsize=(15,10))<br>nx.draw(H, with_labels=False, node_size=30)<br>plt.show()</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F7JFWKa7t4YhMvZxVM3fBw.png" /></figure><h3>End Notes</h3><p>So this is all about collecting data and deriving insights from the GitHub social network. This is just a sample application and we can do a lot of exploration from this data. If you feel that I have missed any important part, please feel free to comment it.</p><p>Yes, you&#39;ve learned a new thing today. It is the time to give feedback. Enjoy learning! :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=28f72b2f5e3" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>