<?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 Athirapsalin on Medium]]></title>
        <description><![CDATA[Stories by Athirapsalin on Medium]]></description>
        <link>https://medium.com/@athirapsalin?source=rss-fa2cfcba9458------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*M3iuDBnR6az5ckavqCeozg.jpeg</url>
            <title>Stories by Athirapsalin on Medium</title>
            <link>https://medium.com/@athirapsalin?source=rss-fa2cfcba9458------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 22:10:43 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@athirapsalin/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[Statistics For Data Analytics and Data Science-1]]></title>
            <link>https://medium.com/@athirapsalin/statistics-for-data-analytics-and-data-science-1-596eb0101ade?source=rss-fa2cfcba9458------2</link>
            <guid isPermaLink="false">https://medium.com/p/596eb0101ade</guid>
            <dc:creator><![CDATA[Athirapsalin]]></dc:creator>
            <pubDate>Thu, 07 Nov 2024 12:39:47 GMT</pubDate>
            <atom:updated>2024-11-07T12:39:47.555Z</atom:updated>
            <content:encoded><![CDATA[<p>Statistics is the science of collecting, organizing, and analyzing data, which helps in decision-making. Data consists of facts or information that are measured, collected, or analyzed.</p><p>Data Analysts employ statistical methods to analyze and interpret data, identifying patterns and insights. They create reports and visualizations that provide meaningful decisions.</p><p>Data science is an interdisciplinary field that combines statistics, mathematics, and computer science to extract insights and knowledge from structured and unstructured data. Data scientists create models by analyzing data according to the use case.</p><p>The importance of statistics in data science and analytics cannot be overstated. Statistics helps in:-</p><p>● Data Exploration</p><p>● Model Building and Validation</p><p>● Statistical Analysis</p><p>● Hypothesis Testing</p><p>● Optimization and efficiency</p><p>● Report Making</p><h3>Types of Statistics</h3><h3>1. Descriptive Statistics</h3><p>Descriptive statistics involve methods for summarizing and organizing data, making it more comprehensible. This type of statistics helps describe the basic features of data in a study. It studies:-</p><p>● Measures of Central Tendency (mean, median, mode)</p><p>● Measures of Dispersion ( variance, standard deviation)</p><p>● Data Distribution (Histogram, boxplot, Pie chart, PDF, PMF, CDF)</p><p>● Summary Statistics ( Five number summary — Q<em>1</em>, Q<em>2</em>, Q<em>3</em>, Max, Min)</p><h3>2. Inferential Statistics</h3><p>Inferential statistics involves methods for making predictions or inferences about a population based on a sample of data. It allows for hypothesis testing, estimation, and conclusion. It involves:-</p><p>● Hypothesis Testing</p><p>● P Value</p><p>● Confidence Interval</p><p>● Statistical Analysis Test (Z-test, t-test, ANOVA, Chi-Square, Regression analysis)</p><h3>Example</h3><p>Let’s say there are twenty statistics classes in your university. You have collected the height of students in the class. Heights are recorded as [175cm, 135cm, 180cm, 140cm, 120cm ].</p><h3>Descriptive Question</h3><p><em>What is the average height of the entire class? (mean height)</em></p><h3>Inferential Question</h3><p><em>Are the heights of the sample students in the classroom similar to what you expect from the entire university?</em></p><h3>What is Population and Sample?</h3><p><strong>Population:- the entire set of individuals or objects of interest in a particular study.</strong></p><p>● Complete set:- contains all the observations of interest.</p><p>● parameter: — a numerical value summarizing entire population( population mean, population variance)</p><p>● Examples:</p><p>● <strong><em>The population in a school</em></strong> refers to the complete set of students within the school, providing information about all students in the institution. To determine the average height of students</p><p>● <strong><em>Population in Market research</em></strong> with information on consumers in a city to understand the purchasing behavior of all consumers.</p><p>● <strong><em>Population in a medical study</em></strong> with information on all patients with a specific disease where they study the effectiveness of a drug.</p><p><strong>Sample Data:- the subset of the population that is used to represent the entire group. Here sampling is the technique of selecting a group of individuals/observations from the population to conclude.</strong></p><p>● Subset:- Represent a portion of the population.</p><p>● parameters:- A numerical value summarizing the sample data ( sample mean, sample variance)</p><p>● Examples:-</p><p>● <strong><em>Sample in a school study</em></strong> where a group of 50 students from school is selected. Here the use case is to estimate the average height of students in a school.</p><p>● <strong><em>Market Research sample</em></strong> where 500 consumers are selected and their behavior studied to generalize the population.</p><p>● <strong><em>Medical Study research</em></strong> where 200 patients are selected to test the effectiveness of the drug.</p><h3>Types of Sampling</h3><h3>1. Probability Sampling</h3><p>⒈ <strong>Simple random sampling:-</strong> every member of the population has an equal chance of being selected. For example, drawing names randomly from a class of students.</p><p>⒉ <strong>Systematic Sampling:- </strong>select every n<em>th</em> number of the population after a random starting point. For example, at an airport, every 5<em>th</em> person is pitched for a credit card.</p><p>⒊ <strong>Stratified Sampling:- </strong>Divide the population into strata (groups) based on specific characteristics and then randomly sample from each stratum. For example, divide the employees by department and then randomly select a proportional number from each department to form a survey sample.</p><p>⒋ <strong>Cluster Sampling</strong>:- Divide the population into clusters, randomly selecting clusters and then sampling all the members from the selected clusters. For example, randomly select several schools from a district and survey all teachers within those schools.</p><p>⒌ <strong>Multi Stage Sampling</strong>:- Combining several sampling methods. For example, randomly selecting cities, and then each city selected randomly selecting households to survey.</p><h3>2. Non Probability Sampling</h3><p>⒈ <strong>Convenience Sampling:-</strong> select individuals who are easiest to reach. For example, surveying people at malls.</p><p>⒉ <strong>Judegemental (Purposive) Sampling:-</strong> select individuals based on the researcher’s judgment, which can be used for representation. For example, choose experts in a field to participate in a conference.</p><p>⒊ <strong>Snowball Sampling:-</strong> existing study subjects recruit future subjects from among their acquaintance. For example survey members of a rare disease.</p><p>⒋ <strong>Quota Sampling:-</strong> selecting samples from quotas/ categories. For example ages, groups, gender, caste.</p><h3>Types of Data</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/941/1*FFBZ876li6SlG8eVnlqrsg.png" /></figure><h3>Scales of Measurement of Data</h3><p>The nature of information within the value assigned to variables. There are four primary scales of measurement.</p><p>⒈ <strong>Nominal scale:</strong>- classifies data into distinct categories that do not have an intrinsic order. This data is qualitative or categorical based on labels, names, or qualities. These categories are mutually exclusive and there is no logical order among categories. For example gender, color, and types of cuisine.</p><p>⒉ <strong>Ordinal scale:</strong>- classifies data that can be ranked or ordered. Here also the data type is categorical but ranked in specific order. The intervals between ranks are not necessarily equal. For example education level such as high school, bachelors, masters, doctorate, etc.</p><p>⒊ <strong>Interval Scale:-</strong> The interval scale not only categorizes and orders but also specifies the exact difference between intervals which allows for meaningful comparison of differences but it lacks a true zero point. For example, temperatures in Fahrenheit are given as 10⁰F, 20⁰F, and 30⁰F. The interval here having an exact value 10((20–10),(30–20)), but with the given value 0⁰F is not possible.</p><p>⒋ <strong>Ratio Scale:</strong>- In this scale order matters, differences are measurable and contain a zero starting point. For example, marks in a class are given as 0,90,60,30,75,45. If we arrange the data in ascending order then each observation can be compared with any other for a comparative study.</p><h3>Assignment</h3><p>⒈ Length of different rivers in the world:- Interval scale</p><p>⒉ Favourite food based on Gender:- Ordinal</p><p>⒊ Marital Status:- Nominal</p><p>⒋ IQ measurement :- Ratio Scale</p><h3>References</h3><p><a href="https://www.udemy.com/course/complete-data-analyst-bootcamp-from-basics-to-advanced/learn/lecture/45356983?start=15#overview">https://www.udemy.com/course/complete-data-analyst-bootcamp-from-basics-to-advanced/learn/lecture/45356983?start=15#overview</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=596eb0101ade" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introduction to Statistical Learning-part 1]]></title>
            <link>https://medium.com/@athirapsalin/introduction-to-statistical-learning-part-1-a3650ffbaed6?source=rss-fa2cfcba9458------2</link>
            <guid isPermaLink="false">https://medium.com/p/a3650ffbaed6</guid>
            <dc:creator><![CDATA[Athirapsalin]]></dc:creator>
            <pubDate>Wed, 09 Oct 2024 04:41:28 GMT</pubDate>
            <atom:updated>2024-10-09T04:41:28.161Z</atom:updated>
            <content:encoded><![CDATA[<p>Statistical learning, a field within the broader discipline of machine learning, encompasses a range of techniques and approaches for analyzing and understanding complex data, which can be described as learning from data. Data is generally used here to predict the outcome for a new unseen object, and a good learner accurately predicts such outcomes. There are two types of learning approaches: supervised learning and unsupervised learning.</p><p>Supervised:- presence of outcomes variables to guide the learning process.</p><p>Unsupervised:- observe only features and have no measurements of the outcomes. Tasks will mostly describe how the data is organized or clustered.</p><p>The results of statistical learning can take various forms depending on the nature of the data. When working with numerical values, the variables are quantitative, such as rainfall amounts. Alternatively, when dealing with qualitative values, the variables are referred to as categorical or discrete, like a binary outcome or disease status. Qualitative variables are often represented by codes, the most useful and commonly used coding is via dummy variables. A K-level qualitative variable can be represented using a vector of K binary variables or bits, with only one bit being “on” at a time. While more compact coding schemes may be possible, dummy variables provide a symmetric representation of the variable’s level [1]. There is also a third type of variable called ordered categorical such as small, medium, and large where there is ordering between values but no metric notion.</p><p>The difference in output variable type leads to distinct names for prediction tasks. If the output to be predicted is numerical, it is called a regression task, whereas if the output to be predicted is categorical, it is called a classification task.</p><p>General denotation for variables:</p><p>● Input variables are denoted by X and if a vector the $X_j$.</p><p>● Quantitative outputs by Y</p><p>● Qualitative outputs by G (often representing a group).</p><p>● Uppercase (X, Y, G)for generic aspects and for representing observed values mostly lowercase (x,y,g) is used.</p><p>● Matrices:- bold uppercase (<strong>X</strong>)</p><p>All the predictions rules are constructed upon data and this data is called <strong><em>training data</em></strong>. The model learns the relationships between the input X and the output Y or G through this training data.</p><h3>References</h3><p>[1] T. Hastie, R. Tibshirani and J. H. Friedman, “The elements of statistical learning: data mining, inference, and prediction”.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a3650ffbaed6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[“Binary Classification of ‘Type’ Column Using Unique Identifier in Two Separate Tables: Unveiling…]]></title>
            <link>https://medium.com/@athirapsalin/binary-classification-of-type-column-using-unique-identifier-in-two-separate-tables-unveiling-9aec55396145?source=rss-fa2cfcba9458------2</link>
            <guid isPermaLink="false">https://medium.com/p/9aec55396145</guid>
            <dc:creator><![CDATA[Athirapsalin]]></dc:creator>
            <pubDate>Thu, 25 Apr 2024 08:05:21 GMT</pubDate>
            <atom:updated>2024-04-25T08:05:21.050Z</atom:updated>
            <content:encoded><![CDATA[<h3>Binary Classification: Unveiling Patterns and Insights</h3><h4>Data Science Internship Case Study</h4><p><strong>Flow of steps to solve the Problem Statement</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SI6m6w4IjYN1Zuhai_blPw.png" /><figcaption>The Flow of stages during solving the problem statement</figcaption></figure><ol><li><strong>Understanding the Problem</strong></li></ol><p><strong>Problem</strong>:- Perform a Binary Classification of column ‘Type ’ given a dataset in two different tables with unique identifier ‘ID’.</p><p><strong>Goal</strong>:- Find an elegant way to perform Binary Classification.</p><p><strong>What is Binary Classification?</strong></p><p>Binary Classification is a supervised machine learning algorithm that categorises new observations into two different classes, that is it fundamentally do predictions about which class the input should be placed into.</p><p><strong>Solution :- <em>Speak to the data</em></strong></p><p>Look at the given dataset and find a way to elegantly solve the problem.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/973/1*CKuh2ZvgEteBseY58-SaUA.png" /><figcaption>Table 1</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/926/1*6VkuAqGQyW8cKL6a0kgynA.png" /><figcaption>Table 2</figcaption></figure><p><em>. </em>The Dataset provided contain both numerical and categorical data.</p><p>. Perform one hot encoding on categorical data to make use in the model.</p><p>. Study the importance of different features consider the <strong>Informative Features </strong>and remove the less important features.</p><p>. Train on several models for Binary Classification and consider the best model.</p><p>. Understand importance of variables based on learning and existing bias in our model.</p><h3><strong>Data Preprocessing</strong></h3><p><strong>2. Understanding and Cleaning the Data</strong></p><p>Understanding data is very important to assess the quality and reliability of the data.</p><p>. <strong>Load the dataset :- </strong>Load the given datasets using pandas library as a DataFrame.</p><p>. <strong>Checking for duplicates</strong> :- If the data contain duplicates it will be less reliable and cannot be used to get informed decisions. The drop_duplicates() method removes duplicate rows in the DataFrame. Then merge the two tables on ‘ID’ to get the combined dataset using merge method in pandas.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/805/1*deAd_yiYCRy6QWQaSXZNnA.png" /><figcaption>Merged Dataset after removing duplicates</figcaption></figure><p>. <strong>Check and handle missing values</strong></p><p>Missing values can lead to a unrepresentative sample which will lead to bias in the results. The plot below shows the number of missing values in each column of the dataset.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/561/1*C9G5gAk1m92zlCVbuAdw1g.png" /><figcaption>Missing values in each column.</figcaption></figure><p>Different methods can be used to handle missing values depending upon the nature of the data, such as removing the row/column with high percentage of missing values, imputation methods with mean, median, mode, interpolation, predictive models etc.</p><p>. The column ‘ZIK’ has a high percentage of missing values, so it is better to remove that column from the dataset to avoid bias in the result.</p><p>. Sklearn <a href="https://scikit-learn.org/stable/modules/impute.html#impute">SimpleImputer</a> class provides basic strategies for imputing missing values. In this problem the numerical missing data are imputed with mean and categorical missing data are imputed with mode.</p><p><strong>. Check and handle Skewness and Outliers</strong></p><p>It is important to understand how variables are distributed in a dataset.<strong> Skewness</strong> is the asymmetry of the probability distributions of a dataset. <strong>Outliers</strong> are the extreme values that deviate significnatly from majorityof the datpoints in a dataset. Both skewness and outliers can lead to incorrect conclusions or interpretations in the data.</p><p>Distribution <a href="https://seaborn.pydata.org/tutorial/distributions.html">visualization</a> techniques can offer rapid insights into the level of skewness and presence of outliers in a dataset. Here the skewness and outliers is studied for each numerical variables separately.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7Wf6AzcC2mfJSIUIQpj95A.png" /></figure><p>Here the skewness is addressed by doing a log transformation on the highly skewed independent numeriacal variables. Then all the numerical variables are sclaled using a minmaxscaler, scaling is a technique used to make data points closer together if they are far apart. Essentially, scaling generalizes the data points so that the distance between them is reduced.</p><p><strong>. Check for imbalance in the target variable</strong></p><p>Imbalance in the target variable can lead to bias in the model performance towards the majority class.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/389/1*l3fhZ_pucuDK1UFrw3ESgQ.png" /><figcaption>Imbalance in “Type” (target variable)</figcaption></figure><p>The imbalance can be addressed by different resampling techniques like oversampling on minority class, undersampling on majority or assigning class weights while training the model etc. It is recommended to use oversampling on minority class if the dataset is small.</p><h3>Feature Engineering</h3><p>Feature engineering is done to improve the performance of Machine learning models by transforming existing features into more informative features.</p><p>. <strong>Check and handle Correlation</strong></p><p>Correlation analysis helps to identify potential multicollinearity issues among independent features. Multicollinearity can negatively impact model interpretability and cause instability in the model. Inorder to identify multicollinearity the categorical variables are one hot encoded first and then a correlation studied among all the independent features. In order to avoid multicollinearity a threshold correlation is used to mask the ones with higher correlation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PeZ3sYJMY6R1xjaC0ijirA.png" /><figcaption>Heatmap showing correlation among independent features (left), heatmap showing correlation among independent features after masking the highly correlated features (right)</figcaption></figure><p>. <strong>Feature Selection</strong></p><p>To make effective decisions, it is crucial to pinpoint the most significant predictors and eliminate any correlated features. This process, known as feature selection, results in a more streamlined model and minimizes overfitting. Additionally, assessing the importance of each feature helps to clarify predictions and provides trust in the model’s decision. This addresses the curse of dimensionality and performs dimensionality reduction.</p><p>There are different methods for feature selection,which include filter method, wrapper method, Embedded method. Here <a href="https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.ExtraTreesClassifier.html#sklearn.ensemble.ExtraTreesClassifier">ExtraTreesClassifier</a> from sklearn is utilized to select the important features. It fits a number of randomized decision trees on various subsamples of dataset and uses to improve the predictive accuracy and control over fitting, importance of feature here is computed as the total reduction of the criterion brought by that feature.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/896/1*_02scKmw5Ydcm2uOtZn5BA.png" /><figcaption>Importance of each feature</figcaption></figure><p>Select the optimal features by retaining the features with importance greater than the specified threshold.</p><h3><strong>Model Selection</strong></h3><p>.<strong>Check and handle Outliers</strong></p><p>Detecting anomalies within the relevant feature space is important for more accurate results. The feature dimension is reduced using <a href="https://scikit-learn.org/stable/modules/generated/sklearn.manifold.TSNE.html">TSNE</a> (T-distributed Stochastic Neighbor Embedding ), it capture local relationships and cluster in high dimensional data. Sklearn provides a set of machine learning tools for <a href="https://scikit-learn.org/stable/modules/outlier_detection.html">oultier detection</a>. In this case study the One Class SVM method is used for outlier detection which is performed on the reduced data set using TSNE, for improved anomaly detection, reduced computational complexity and for better visualization and interpretation. It learns the distribution of normal data and identifies outliers as data points that fall outside this learned boundary.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/579/1*L8rJ9aE95qHoOrmlDGGeWg.png" /><figcaption>Reduced independent features using PCA</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/574/1*MxP7n5YHkq3DT-qNVU6xYw.png" /><figcaption>outlier removed using OneClassSVM</figcaption></figure><p>.<strong>Model Evaluation</strong></p><p>In the field of machine learning, finding the best combination of hyperparameters for a model can significantly impact its performance. Hyperparameters are crucial settings that need to be defined before training a machine learning algorithm, and tuning them can be a daunting task. Here Logistic Regression, Random Forest, and Support Vector Machine (SVM) are the models considered with 5-fold cross-validation to tune the hyperparameters, and the evaluation metric used to assess the models is the Area Under the Receiver Operating Characteristic Curve (ROC AUC).</p><p>.<strong>Best Model</strong></p><p>Random Forest performed well with metrics scores as given below</p><pre> Metrics Values<br>0 Accuracy 0.943089<br>1 Precision 0.980451<br>2 Recall 0.957416<br>3 F1 Score 0.968796<br>4 AUC 0.955071</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/578/1*2m828d-bVQlfKd3qXnHE5w.png" /></figure><p>.<strong> Thresholding</strong></p><p>Adjusting the threshold when converting probabilities to class labels is important for several reasons. It can help balance precision and recall, address class imbalance, calibrate the model, and aid in decision making. The default threshold is 0.5, but changing it can significantly affect the model’s performance and interpretation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/561/1*IT4v-mfTXuAuDtc51n2Z9w.png" /><figcaption>The intercept will be the threshold value.</figcaption></figure><p>The metric after thresholding</p><pre> Score<br>Precision 0.979228<br>Recall 0.969163<br>F1 Score 0.974170<br>Accuracy 0.952575</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9aec55396145" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>