<?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 kailash sukumaran on Medium]]></title>
        <description><![CDATA[Stories by kailash sukumaran on Medium]]></description>
        <link>https://medium.com/@kailash7dev?source=rss-c31e327965ca------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*HvbtF5z720blhWt0N8yeVg.jpeg</url>
            <title>Stories by kailash sukumaran on Medium</title>
            <link>https://medium.com/@kailash7dev?source=rss-c31e327965ca------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 18:11:40 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kailash7dev/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[Data Engineering Best Practices: Why Extract, Transform, and Load (ETL) Should Be Decoupled]]></title>
            <link>https://medium.com/@kailash7dev/data-engineering-best-practices-why-extract-transform-and-load-etl-should-be-separated-e31045f74f85?source=rss-c31e327965ca------2</link>
            <guid isPermaLink="false">https://medium.com/p/e31045f74f85</guid>
            <dc:creator><![CDATA[kailash sukumaran]]></dc:creator>
            <pubDate>Mon, 04 Sep 2023 21:26:13 GMT</pubDate>
            <atom:updated>2023-09-04T21:29:17.276Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xBxePpO4WYc6ZHSKkurGwg.jpeg" /></figure><p>In the ever-evolving world of data management and analytics, one principle remains steadfast: data is the lifeblood of informed decision-making. This data, often dispersed across various sources and formats, must be collected, transformed, and loaded into a target system for analysis. This process, known as Extract, Transform, and Load (ETL), has traditionally been treated as a monolithic operation. However, the trend today is to decouple the ETL process, splitting it into distinct stages. In this blog, we will explore the compelling reasons why ETL should be decoupled.</p><p><strong>1. Scalability and Parallel Processing</strong></p><p>Decoupling ETL allows for each stage to scale independently. This means you can allocate resources specifically where they are needed. For example, if your data extraction stage requires more horsepower due to a sudden increase in data volume, you can scale it up without impacting the transformation or loading phases. This scalability ensures optimal resource utilization and faster processing times, especially when dealing with large datasets.</p><p><strong>2. Fault Tolerance</strong></p><p>ETL pipelines often span multiple systems and networks, making them susceptible to failures at various points. Decoupling the process enables better fault tolerance. When one stage encounters an issue, it can be isolated and retried without affecting the entire ETL flow. This enhances the overall reliability of the pipeline, ensuring that data is successfully processed and loaded even in the face of transient errors.</p><p><strong>3. Flexibility and Maintenance</strong></p><p>In a coupled ETL process, any change to one stage can have a cascading effect on the entire pipeline, requiring extensive testing and potentially causing downtime. Decoupling mitigates this risk by allowing for flexibility in development and maintenance. Each stage can be modified, upgraded, or replaced without disrupting the others. This means faster development cycles, easier debugging, and less risk of introducing unintended consequences.</p><p><strong>4. Real-time and Stream Processing</strong></p><p>As businesses increasingly demand real-time insights, decoupled ETL provides a foundation for streaming data processing. Data can be extracted, transformed, and loaded as it arrives, enabling organizations to make decisions in near real-time. This is especially valuable in domains such as financial services, where timely data is critical for trading decisions and risk management.</p><p><strong>5. Better Resource Management</strong></p><p>With decoupled ETL, resource allocation becomes more efficient. Resources can be dynamically allocated based on the requirements of each stage. This means you don’t need to provision the same resources for extraction, transformation, and loading, saving on costs and optimizing performance.</p><p><strong>6. Improved Monitoring and Logging</strong></p><p>Decoupled ETL pipelines allow for granular monitoring and logging at each stage. This visibility into the individual components of the process enables better debugging, performance tuning, and error handling. It also facilitates compliance with data governance and auditing requirements.</p><p><strong>Conclusion</strong></p><p>Decoupling the ETL process is a strategic move that aligns with the evolving demands of modern data management. It offers benefits in terms of scalability, fault tolerance, flexibility, real-time processing, resource management, and monitoring. By embracing this approach, organizations can harness the full potential of their data while reducing complexity, improving efficiency, and staying agile in a rapidly changing data landscape. As you embark on or refine your data integration journey, consider decoupling your ETL processes to unlock new possibilities and drive data-driven success.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e31045f74f85" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deep Dive into  Naive Bayes: Intermediate Level]]></title>
            <link>https://medium.com/@kailash7dev/deep-dive-into-naive-bayes-intermediate-level-bf77d2b0240a?source=rss-c31e327965ca------2</link>
            <guid isPermaLink="false">https://medium.com/p/bf77d2b0240a</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data-analytics]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[naive-bayes]]></category>
            <category><![CDATA[naive-bayes-classifier]]></category>
            <dc:creator><![CDATA[kailash sukumaran]]></dc:creator>
            <pubDate>Sat, 25 Apr 2020 07:35:35 GMT</pubDate>
            <atom:updated>2020-04-25T15:15:42.009Z</atom:updated>
            <content:encoded><![CDATA[<h3>Deep Dive into Naive Bayes: Intermediate Level</h3><p>In my previous blog I have covered most popular classification algorithm <a href="https://medium.com/@kailash7dev/understanding-k-nn-algorithm-a8bbbcc5a1f">K-Nearest Neighbors.</a></p><p>Today we will look into another popular classification algorithm Naive Bayes.</p><p>Naive — Means we are making a naive assumption on features, Each feature is independent on each other.</p><p>Bayes — refers to the author name Thomas Bayes.</p><p>Naive Bayes is considered as benchmark for text classification.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/553/1*fJ7WWR4YSGTY4hfPCO4gUw.png" /></figure><p><strong>Breaking down Naive Bayes:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/629/1*9QBU4iw-maI7HN2_F9qz4w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*xvfDkFDZdGENUutE90oc5w.png" /></figure><p><strong>Brief explanation of Naive Bayes:</strong></p><p><strong>Consider this dataset:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/592/1*P6mpMXzrnjUJS6Uy-QR0hw.png" /></figure><p>Class variable of the dataset is Play feature, where outcomes are Yes (or) No.</p><p>We have features Outlook, Temperature, Humidty and Wind.</p><p>Features and their corresponding categorical values:</p><p>P(Outlook=o|ClassPlay=b), where o ∈[Sunny, Overcast, Rainy] and b ∈ [yes, no]</p><p>P(Temperature=t|ClassPlay=b), where t ∈[Hot, Mild, Cool] and b∈ [yes, no],</p><p>P(Humidity=h|ClassPlay=b), where h∈ [High, Norma] and b∈ [yes, no],</p><p>P(Wind=w|ClassPlay=b), where w ∈ [Weak, Strong] and b ∈ [yes, no].</p><p><strong>Computing Frequency table &amp; probability for each feature with class feature:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/772/1*ellv0AraLSfz8Kmg29zLCw.png" /></figure><p>We can also calculate frequency table for Class vs Class variable:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/773/1*tOZNjJ3ZymVre1hmOJq4zw.png" /></figure><p>Let’s say, we get a new instance of the weather condition, x’=(Outlook=Sunny, Temperature=Cool, Humidity=High, Wind=Strong) that will have to be classified (i.e., are we going to play tennis under the conditions specified by x’).</p><p>P(ClassPlay=Yes|x’) = [P(Sunny|ClassPlay=Yes) × P(Cool|ClassPlay=Yes) ×</p><p>P(High|ClassPlay=Yes) × P(Strong|ClassPlay=Yes)] ×</p><p>P(ClassPlay=Yes)</p><p>= 2/9 × 3/9 × 3/9 × 3/9 × 9/14 = 0.0053</p><p>P(ClassPlay=No|x’) = [P(Sunny|ClassPlay=No) ×P(Cool|ClassPlay=No) ×</p><p>P(High|ClassPlay=No) × P(Strong|ClassPlay=No)] ×</p><p>P(ClassPlay=No)</p><p>= 3/5 × 1/5 × 4/5 × 3/5 × 5/14 = 0.0205</p><p>Since P(ClassPlay=Yes|x’) less than P(ClassPlay=No|x’), we classify the new instance x’ to be “No”.</p><p>For every feature category similar table is calculated and stored in dictionary.</p><p><strong>Complexity:</strong></p><p>Time complexity — O(ndc)</p><p>Space complexity — O(dc)</p><p>Test time complexity — O(dc)</p><p>Naive Bayes is much better in the time of space complexity and runtime time complexity.</p><p>Mostly used in text classification, Spam-filter, Positive/Negative.</p><p><strong>Naive Bayes on Text Dataset :</strong></p><p>After performing NLP we would have d-number of unique words in our list, where each is considered to be a feature.</p><p>W = [W1, W2, …..Wd] are the list of features in Dataset after NLP.</p><p>Then,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/633/1*3gOBdv2dL2zJHaEy8bpbfw.png" /></figure><p>Considering probability of a word in train data:</p><p>let Wi =’Vancouver’ be the random word.</p><p>How to calculate probability of a word ‘Vancouver’ in Train Data which is present in test dataset but not in train dataset:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/643/1*z-b9V0KsNXYUYs1bIfzMMw.png" /></figure><p><strong>Missing word:</strong></p><p>If its not present in train dataset, we wont be able to find the frequency table nor probability of the ‘Vancouver’ corresponding to class in memory for computing Probability for testing the model:</p><p>Probability turns out to be 0, as # of times ‘Vancouver’ present in train dataset is 0.</p><p>To overcome this problem we do laplace smoothing:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/644/1*S8o4lJLqp7TkHvA5l834ew.png" /></figure><p>We add α and K to our prob term for each word in train and test dataset.</p><p>K= # of unique values Wi can take, in otherwords for text its 0 or 1. If its a word, binary count is considered and if its a feature with numbers all the unique values in the features are consider.</p><p>α — can be any number, typically its 1, its called add-one smoothing.</p><p><strong>α Behaviour:</strong></p><p>As α increases, we are trying to move likelihood probability to uniform distribution.</p><p>we apply laplace transform to make it stable.</p><p>α is the only hyperparameter in Naive Bayes.</p><p>α determines the model is overfit ot underfit.</p><p><strong>Log Probability for numerical stability:</strong></p><p>P( Y=1 | W) = P(Y)* P(W1 | Y=1) ……*P(Wd | Y=1)</p><p>= 0.2 * 0.4 …….* 0.5</p><p>=&gt; When we multiply 100s of numbers in decimal points we undergo numerical stability and numerical underflow. If the decimal points are more than 16 digits, Python stars to do rounding.</p><p><strong>Solution: We take log on both sides</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/597/1*NTR0Lp7o0MWfwwj6AR9u6g.png" /></figure><p><strong>Bais and Variance Tradeoff:</strong></p><p>How α affecting the model and Bais Variance Trafeoff</p><p><strong>Case 1: α = 0</strong></p><p>Say if there are rare words in our Train-Dataset, like civilisation, Psychology etc. The frequency of those words is very less, might be 2 or 3 max.</p><p>Say if we remove those rarely used words from our model, this causes more change in our model =&gt; high variance =&gt; over fitting.</p><p>This leads to overfitting as we are considering even rarely repeated words for training model.</p><p><strong>Case α =10000 (very large):</strong></p><p>So here determining factor boils down to the term P(Y= 1 or 0)</p><p>Whichever class has more count, query point Xi belongs to that respective class. Like similar thing happened in KNN.</p><p><strong>Feature Importance &amp; Interpretability for NB:</strong></p><p>Feature importance can be attained using model itself.</p><p>As we have probability score of livelihood term, P (Wi | Y= 1) or P (Wi | Y= 0), Sort the values in descending order, top values are considered as important features/ words.</p><p>We could say that words with high livelihood probability are the important words for determining +ve class label. Similarly for the words in -ve class label.</p><p><strong>Handling Imbalanced Dataset:</strong></p><p>1. Up sampling or Down Sampling, they make the prior term 1/2.</p><p>2. Instead of making prior term 1/2 we can just remove the term itself as both means the same. ( this is mostly used)</p><p>3. NB theorem can be modified for unbalanced dataset but this is not often used.</p><p><strong>Handling outliers:</strong></p><p>1. Ignore words which occurs less than n-times.</p><p>2. Laplace Smoothing will take care of outliers both in train and test dataset.</p><p>α -&gt; must be reasonable. As α have more effect on terms with less numerator.</p><p>Happy Learning!</p><blockquote><a href="https://medium.com/@kailash7dev/understanding-k-nn-algorithm-a8bbbcc5a1f">Understanding K-NN Algorithm.</a></blockquote><p>Feel free to connect:</p><p><a href="http://www.linkedin.com/in/kailash-sukumaran">www.linkedin.com/in/kailash-sukumaran</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bf77d2b0240a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding K-NN Algorithm.]]></title>
            <link>https://medium.com/@kailash7dev/understanding-k-nn-algorithm-a8bbbcc5a1f?source=rss-c31e327965ca------2</link>
            <guid isPermaLink="false">https://medium.com/p/a8bbbcc5a1f</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[knn-algorithm]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[data-analytics]]></category>
            <category><![CDATA[tableau]]></category>
            <dc:creator><![CDATA[kailash sukumaran]]></dc:creator>
            <pubDate>Sun, 08 Dec 2019 14:35:09 GMT</pubDate>
            <atom:updated>2020-02-27T01:24:43.168Z</atom:updated>
            <content:encoded><![CDATA[<p>To my perspective K-NN is the simplest algorithm in the world of machine learning, <em>Why?</em> because it doesn’t use any probability or statistics concepts to compute the class label.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/995/1*8beJN4nKl6uTROxRF7W8zw.png" /></figure><p>In a democratic countries like India, States, Canada etc.. A government is formed by conducting an election and the party with majority votes are allowed to form a government.</p><p>K-NN works the similar way, after conducting a majority vote from the points nearby query point (Xi), which ever class gets majority votes, Xi’s class label is declared to belong to that class.</p><p>Regional people who vote - Nearest neighbor of Xi.</p><p>Party which wins - Class label which gets more votes.</p><p>Government formed- Class with more votes are declared to be Xi’s class label.</p><p><strong>How K-NN Algorithm works:</strong></p><p>Step 1: Find the K-nearest points to the query point (Xi).</p><p>Step 2: Find the Class label K-nearest points belongs to.</p><p>Step 3: Compute voting to find which class label get more vote.</p><p>Step 4: Whichever Class gets more vote, declare Xi belongs to that class label.</p><p>Example: There is a query point Xi , surrounded by n number of data points.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cld2q8ODTjmeDgOEozw9SA.jpeg" /></figure><p><strong>Since our K = 7, we consider only 7 nearest point to our Xi , which is found to be X1, X2, X3, X4, X5, X6, X7</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/475/1*oK9z-t_uNYSA2qU4Pl3BHA.png" /></figure><p>Hence we can conclude that our query point (Xi) belongs to class label — ▲</p><p><strong>How do we find K-nearest points: Distance between the points can be calculate by:</strong></p><p><strong>1.1 Euclidean distance.</strong></p><p>Take 2-D space, where Euclidean distance between two points X1 and X2 :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*42TGFzvvZFUYtrHYnmLVrQ.jpeg" /></figure><p><strong>1.2 Manhattan Distance</strong></p><p>Manhattan distance is nothing but a block distance between 2 points:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sq5wGI1i_1G-AHGFkAMHsg.jpeg" /></figure><p><strong>1.3 Cosine-Similarity / Cosine — Distance:</strong></p><p>Cosine Similarity is <em>cos ϴ</em> , where ϴ is angle between 2 points.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DyvirQUu7eb7frUGHg0r2w.jpeg" /></figure><p>Cosine Distance = 1- Cosine Similarity</p><p>Ranges from -1 to 1.</p><p><strong>1.4 Hamming Distance:</strong></p><p>Number of points a binary/ Boolean vector differ.</p><p>In this case lets consider we have 2 data points X1 and X2 which is a binary vector.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xTGbTm8gf_h9EowhCgwf8w.jpeg" /></figure><p><strong>Which is the perfect K-value:</strong></p><p>For different values of K, accuracy on cross validation data set is calculated. A graph is plotted with K-value vs Accuracy, like given below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hdj80CoXp6sZZ9KtOzzDXA.jpeg" /></figure><p>Whichever K have more accuracy on Dcv that is considered as perfect K.</p><p>We could see that when <strong>K= 10</strong>, we get maximum accuracy of <strong>95%</strong>, So we can consider K=10 and further test our model using test data set.</p><p>We saw how to compute class label for classification problem, Now we will see for regression problem.</p><p><strong>K-NN Algorithm on Regression problem:</strong></p><p>K-NN can be used for regression problem with simple alteration done to classification K-NN. Instead of calculating majority votes among nearest neighbor, We can find Mean(nearest neighbor) or Median (nearest neighbor).</p><p><strong>How Curse on Dimensionality affects KNN:</strong></p><ol><li>As dimension increases, time and space complexity increases in KNN as its O(nd). where n-&gt; datapoints, d-&gt; dimensions.</li><li>Intuition of distance between points is not vaild in higher dimensions. That is in higher dimension all points are equally distant from each other. Distance functions like euclidean distance stops working in higher dimension.</li><li>In higher dimensions, probability of our model becoming overfit is more.</li></ol><p><strong>Outliers on K-NN:</strong></p><p>If a query point is an outlier in KNN, model accuracy drops drastically. As it becomes to difficulty to find a nearby cluster for voting.</p><p><strong>Imbalance Dataset:</strong></p><p>Say if the data-set is imbalanced with the ratio 90–10% for respective class labels. There is probability of our model predicting all the query point belonging to majority class, as KNN is voting based.</p><p><strong>Interpretability of K-NN:</strong></p><p>Its easy to interpret K-NN on why model predicted query point belongs to that specific class label. i.e Explanation for why our model working in such a way can be given. This is every much useful the medical industry.</p><p><strong>Pros &amp; Cons of K-NN:</strong></p><ol><li>When D is small we can use KNN. When D is large: Dont use KNN, if using consider LSH and kd-tree.</li><li>Interpretability of the model reduces on higher dimension.</li><li>Run time complexity increases on higher dimension.</li><li>Dont use KNN for low latency system. If used in low latency system use LSH, kd-tree.</li><li>Easy to interpret.</li></ol><p>Feel free to connect:</p><p><a href="http://www.linkedin.com/in/kailash-sukumaran">www.linkedin.com/in/kailash-sukumaran</a></p><p>— Kailash Sukumaran</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a8bbbcc5a1f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Classification of flower types -Iris dataset: Beginner’s Level]]></title>
            <link>https://medium.com/@kailash7dev/classification-of-flower-types-iris-dataset-beginners-level-f022f407f5d4?source=rss-c31e327965ca------2</link>
            <guid isPermaLink="false">https://medium.com/p/f022f407f5d4</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[iris-dataset]]></category>
            <category><![CDATA[exploratory-data-analysis]]></category>
            <dc:creator><![CDATA[kailash sukumaran]]></dc:creator>
            <pubDate>Thu, 02 May 2019 20:24:34 GMT</pubDate>
            <atom:updated>2019-05-02T20:37:23.038Z</atom:updated>
            <content:encoded><![CDATA[<p>Classify the Iris Family Flowers.</p><p><strong>About this Dataset:</strong></p><p>The Iris dataset was used in R.A. Fisher’s classic 1936 paper, <a href="http://rcs.chemometrics.ru/Tutorials/classification/Fisher.pdf">The Use of Multiple Measurements in Taxonomic Problems</a>, and can also be found on the <a href="http://archive.ics.uci.edu/ml/">UCI Machine Learning Repository</a>.</p><p>It includes three iris species with 50 samples each as well as some properties about each flower. One flower species is linearly separable from the other two, but the other two are not linearly separable from each other.</p><p><strong>The columns in this dataset are:</strong></p><ul><li>Sepal_Length</li><li>Sepal_Width</li><li>Petal_Length</li><li>Petal_Width</li><li>Species (setosa, versicolor, virginica)</li></ul><p>Objective: Our objective is try to classify the class variable (species) with help of length and width of sepal, petals given.</p><ol><li><strong>Setting up the environment:</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0oAlDzfizZuVOnLsrIeNyw.png" /><figcaption>importing the data</figcaption></figure><p>Importing the dataset and checking.</p><p><strong>2. Preparing the data and overview:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*clx7YfGIzOqT6AiaZqHBtw.png" /><figcaption>Descriptive information about the dataset</figcaption></figure><p>From the above insights we can conclude that we have 5 columns/ attributes including the class variable.</p><p>None of the column have null values.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/614/1*Wn9PpZizRuTKzCrbJ612XQ.png" /><figcaption>Checking the class variable</figcaption></figure><p>Our data is balanced — Meaning the class variable have equal number of sample in each class.</p><p><strong>3. EDA — Exploratory Data Analysis</strong></p><p><strong>3.1 To Find if there any relationship between sepal_length, sepal_width, petal_length and petal_width.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/791/1*yehyLh5uCJi00flnX-ME7Q.png" /><figcaption>Finding relation between the attributes. plot 1.1</figcaption></figure><p>plot 1.1— Comparing the each attributes with each other to get any insights. We can conclude that petal plots (3rd and 4th row) can be used for classification, since petal plots clearly classified the species when compared to sepal plots (1st and 2nd row).</p><p><strong>3.2 Comparing the Probability distribution function to differentiate:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/579/1*lzniF569HPFdAzMLRwBgzg.png" /><figcaption>plot 2.1</figcaption></figure><p>Plot 2.1 — PDF of sepal length of individual species, PDF overlap too much making differentiation tough.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/562/1*Xy2WG46RfkRCnKV4XiB5bQ.png" /><figcaption>plot 2.2</figcaption></figure><p>Plot 2.2 — PDF of sepal width of individual species, PDF overlap too much making differentiation tough.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/530/1*dP34yqXOeioR5z47VO8uXQ.png" /><figcaption>plot 2.3</figcaption></figure><p>Plot 2.3 — PDF of petal length, we could see that setosa can be easily differentiated from other two species using petal length.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/577/1*zNKyz1PIRLUNeYQTXZd25Q.png" /><figcaption>plot 2.4</figcaption></figure><p>Plot 2.4 — PDF of petal width, we could see that setosa can be easily differentiated from other two species using petal length. Even versicolor and virginica only overlap very little making easy to differentiate.</p><p><strong>3.3 sepal length vs sepal width:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/603/1*whlkpZdHaAwuE8Xn7FfENw.png" /><figcaption>Plot 3.1</figcaption></figure><p>We could see that sepal length and width is of no use to us, since they don&#39;t follow any specific pattern.</p><p><strong>3.3 petal length vs petal width:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/478/1*2hO5hyA-i05VqG8NssdSXA.png" /></figure><p>Using petal information easily differentiated the flowers into their species as seen in <strong>petal PDF plots</strong>. Now we can draw insights using the above plots.</p><p><strong>4. Observation:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/415/1*5JpqmOahSKkvY-WRD8_b6w.png" /></figure><p><strong>5. Creating Model:</strong></p><p>Since its beginner level, we have used If- statement to create a model. Moving forward we will be using actual algorithms to create model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/561/1*gLdiJ14bQB3FMRzNckGjqA.png" /></figure><p>From the above model we can predict which family does the flower belong to.</p><p><strong>Test Output:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/416/1*KBagdwWH_TdZqrvAPhQP1w.png" /></figure><p>We can see that using petal width and petal length as input parameter, we can predict the flower family.</p><p><strong>Kindly find the code at GitHub repository:</strong></p><p><a href="https://github.com/Kailash7dev/Flower-Classification-Iris-Dataset">Kailash7dev/Flower-Classification-Iris-Dataset</a></p><p>— Kailash Sukumaran</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f022f407f5d4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cancer Analysis and Creating Model on Haberman’s Dataset: Beginner’s Level]]></title>
            <link>https://medium.com/@kailash7dev/cancer-analysis-and-creating-model-on-habermans-dataset-beginner-s-level-c065b6be5ebc?source=rss-c31e327965ca------2</link>
            <guid isPermaLink="false">https://medium.com/p/c065b6be5ebc</guid>
            <category><![CDATA[cancer]]></category>
            <category><![CDATA[haberman]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[analysis]]></category>
            <dc:creator><![CDATA[kailash sukumaran]]></dc:creator>
            <pubDate>Wed, 01 May 2019 21:39:48 GMT</pubDate>
            <atom:updated>2019-05-01T21:50:07.913Z</atom:updated>
            <content:encoded><![CDATA[<h4><strong>About the data:</strong></h4><p>Today we will be doing Exploratory data analysis on Haberman’s Cancer survival data, which was surveyed in the period 1958–1970.</p><h4>Attribute Information (columns in dataset):</h4><ul><li>Age of patient at time of operation (numerical)</li><li>Patient’s year of operation (year — 1900, numerical), only last 2 digits of the year is mentioned</li><li>Number of positive axillary nodes detected (numerical), number of cancer axillary nodes detected during the time of operation.</li><li>Survival status (class attribute) 1 = the patient survived 5 years or longer 2 = the patient died within 5 year</li></ul><ol><li><strong>Setting up the environment (Import libraries and Data):</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/906/1*tvoc-Y27Z4nJx_oZtcZwpg.png" /><figcaption>Importing libraries</figcaption></figure><p>Importing the required libraries for analysis and their purpose are:</p><ul><li>Pandas is used for handling the dataset.</li><li>Numpy is used for imposing mathematical calculations on the dataset.</li><li>Matplotlib and seaborn is used for visualization.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/920/1*8Pk9Y0s6Lh039pJpXSmKjQ.png" /><figcaption>Importing dataset</figcaption></figure><p>Importing the data from .csv file using pandas library function read_csv().</p><p><strong>2. Preparing the data and overview</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/919/1*R5MKfZUkR9wU47Lk-7lbuQ.png" /><figcaption>Year Format convention</figcaption></figure><p>Since the given year format is in ‘YY’, we could change it into ‘YYYY’.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/914/1*bKuY66NT_hoxxXPDwDHPwA.png" /><figcaption>Numeric Description on Dataset</figcaption></figure><p>Getting a descriptive idea on the data:</p><ul><li>Dataset shape denotes we have 306 rows of data and 4 columns.</li><li>Column name in the dataset is ‘Age’, ‘OperationYr’, ‘Nodes’, ‘Survival’ .</li><li>None of our columns contain Null values.</li><li>Survey was done for the period 1958 to 1969.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/848/1*96-o2Brmen34yFn4Z8smug.png" /><figcaption>Survival and Not Survived Counts</figcaption></figure><p>We have got data of 225 people who survived and 81 people who died after operation.</p><p><strong>3. EDA — Exploratory Data Analysis</strong></p><p><strong>3.1 To Find if there any relationship between age, Operation Year, Nodes with Survival Rate:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/390/1*sczO9745ka3Z3U24WETiSw.png" /><figcaption>1.1</figcaption></figure><p>This Graph depicts the probability distribution function (PDF) for Survived and Not survived patients with respective to their Operation Year (plot 1.1).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/392/1*4vNruoVvutG7iQJjsXBR4A.png" /><figcaption>1.2</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/376/1*OWtACZnx4JOaXuej_4f-tA.png" /><figcaption>1.3</figcaption></figure><p>Similarly this graph depicts the PDF, with respective to Age of the patients (plot 1.2).</p><p>This plot depicts the Nodes of the patients (plot 1.3).</p><p>Compare to 3 plots above, Nodes Plot (1.3 plot ) <strong>showed difference in Survival and Not survived PDF.</strong> So its clear that Nodes influenced the Survival rate.</p><p><strong>3.2 To Find how No. of operations &amp; survival rate changed over the year:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/366/1*0J0Bz6ak-4uolSfN26n-zA.png" /><figcaption>2.1</figcaption></figure><p>We could notice Survived people did more operation than not survived, Almost Double the times. (plot 2.1)</p><p><strong>3.3 To find If there is any relation between the columns/ attributes:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/827/1*CW9ZhwZ5-s_o98zV3pVPEQ.png" /><figcaption>Used Seaborn to plot all the attributes with each other.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/536/1*rgBRtVYfOsvFuDq09LIA5Q.png" /><figcaption>3.1</figcaption></figure><p>In Age vs Nodes plot, class variables can be differentiated from each other. In our further analysis we could consider Age and Nodes attributes mainly, as some pattern can be found. However, all other attributes didn’t show much difference in their PDF. Moving forward we can use Age and Node to further analyze the dataset and know if they influence the survival rate.</p><p><strong>3.4 Finding the relation between Nodes vs Age:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/376/1*Oy71EaEB8qOWD4QxgHc1oA.png" /><figcaption>4.1</figcaption></figure><p>As more green dots are in lower region of the graph. We could get a insight that lesser the Nodes, More the survival rate.</p><p><strong>3.5 To Find Average nodes between Survived and Not survived people:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/373/1*I6QiolnJkDq7GUqbm3UPFw.png" /><figcaption>5.1</figcaption></figure><p>We could get an insight that on average not survived people have threefold times more nodes than survived. (plot 5.1)</p><p><strong>3.6 Bi-variate analysis with Nodes attribute:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/570/1*O70useJuoZpmTE2qDqSOnw.png" /><figcaption>6.1</figcaption></figure><p>We could see that major portion of the nodes for survival people is within 5 nodes. More than 5 nodes survival becomes tough. (plot 6.1)</p><p><strong>3.7 Grouping by the dataset respective to age:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/502/1*dg9RoE0yaVjjF-qzsGNUUw.png" /><figcaption>7.1</figcaption></figure><p>Grouping the dataset into groups of age, we did this because from the above insights we could sense that there is some correlation between age and nodes. (plot 7.1)</p><p><strong>Note:</strong> How we did the above grouping can be found in the github repository, link in the end of the article.</p><p><strong>3.8 To find what ages groups people have more Nodes and their survival:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/539/1*gTE389LFrJIxjhH8Kpdg0w.png" /><figcaption>8.1</figcaption></figure><p>From the above two plots, we get insight that nodes might have influence in not survival rate, Not survived people have more nodes, especially age between 40–70. (plot 8.1)</p><p><strong>3.9 Further analysis on the dataset using Nodes and Age:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/797/1*9l9MDxzvB6R6JWG_VEsMoA.png" /><figcaption>Bar plot of Age vs Nodes (8.2)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/797/1*hkcRfi9iJAIO40Ecq67FgA.png" /><figcaption>scatter plot of Age vs Nodes (8.2)</figcaption></figure><p>large amount of not survived points can be found in middle and slightly upper region of the plot. (plot 8.2)</p><p><strong>4. Insights:</strong></p><p>From the above plots we get following insights we can group of datasets into:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/332/1*pZ8gvkURyaL1UDy-eq0uHw.png" /><figcaption>Insight 1.1</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/758/1*eoY0hmGwi17-dbblZvFdZQ.png" /><figcaption>Insight 1.2</figcaption></figure><p>Large amount of people who survived (around 67%) the cancer operation had<strong> nodes less than 3</strong> and <strong>age was between 44 to 58 </strong>(plot insight 1.2)</p><p><strong>5. Creating a Model:</strong></p><p>Since this is a beginner level we would be using if- conditions to create a model, in future will be using actual algorithms.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/821/1*CJ7vH1hg8HEtPTb_kwkwhQ.png" /><figcaption>Model 1.1</figcaption></figure><p>Using the above model we can predict the survival rate of the patients after the operation done. (plot Model 1.1)</p><p><strong>Test results:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/827/1*xjbhB38ASnsRjJPlINfYWw.png" /><figcaption>Model 1.2</figcaption></figure><p>We could see that our model could predict the survival rate with Age and Nodes as the input parameter. (plot Model1.2)</p><p><strong>Kindly find the code at GitHub repository:</strong></p><p><a href="https://github.com/Kailash7dev/Cancer-Analysis-on-Haberman-s-Datasets">Kailash7dev/Cancer-Analysis-on-Haberman-s-Datasets</a></p><p>— Kailash Sukumaran</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c065b6be5ebc" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>