<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Abhijit Annaldas | Machine Learning Blog</title>
    <description>For the love of data and machines that can learn</description>
    <link>http://abhijitannaldas.com/ml/</link>
    <atom:link href="http://abhijitannaldas.com/ml/feed.xml" rel="self" type="application/rss+xml"/>
    <pubDate>Sun, 07 Jan 2024 06:41:22 +0000</pubDate>
    <lastBuildDate>Sun, 07 Jan 2024 06:41:22 +0000</lastBuildDate>
    <generator>Jekyll v3.9.3</generator>
    
      <item>
        <title>Dimensionality Reduction and Principal Component Analysis (PCA) Explained</title>
        <description>&lt;p&gt;Data is seldom clean and ready for machine learning or predictive modelling. Data preprocessing is time consuming and non-trivial effort in any predictive modelling task. A recent &lt;a href=&quot;https://www.kaggle.com/surveys/2017&quot; target=&quot;_blank&quot;&gt;kaggle survey&lt;/a&gt; says that dirty data is a biggest barrier!&lt;/p&gt;

&lt;p&gt;Once the data is cleaned and pre-processed, the next challenge is finding the important features of the data, engineering new features and ignoring less important or &lt;em&gt;irrelevant&lt;/em&gt; features for the predictive modelling task at hand. Not every piece of data is equally important and may not be relevant in context of the problem being solved. Some attributes may be noise or duplication in some form, and sometime a particular transformation of an attribute (or engineered feature) could be much more relevant than an original attribute.&lt;/p&gt;

&lt;p&gt;Popular ways to find these important features are…&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;Hand crafted feature engineering - deriving features based on existing features, domain expertise and sometimes &lt;a href=&quot;#a&quot; title=&quot;We need to be careful with data augmentation, check for data leak&quot;&gt;data augmentation&lt;/a&gt;.&lt;/li&gt;
  &lt;li&gt;Feature Selection - selecting a subset of important features, ignoring features that don’t contribute towards predictions.&lt;/li&gt;
  &lt;li&gt;Dimensionality Reduction (we’ll discuss PCA in this post) - a type of linear transformations of attributes.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Of the above three, sometimes any one strategy might suffice or a combination of all three could be used. If all three strategies are used, I believe the above sequence is an appropriate approach, please share in comments what do you think.&lt;/p&gt;

&lt;p&gt;PCA has several advantages. It helps find the most effective transformation of existing attributes through a linear transformation technique. It helps with dimensionality reduction, which makes things faster by reducing the size of dataset to be stored and processed. PCA, with dimensionality reduction, also makes visualization easy to some extent as it’s hard to visualize and understand data anything beyond 3 dimensions. Intuitively we can say – &lt;em&gt;It is a change in viewpoint (linear transformation) of a scene (vector space), which gives much clear shot of the objects (data) in the scene!&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Let’s consider an analogy for some intuition, a business which sells flooring products for homes needs some insights. Let’s consider two pieces (as it makes it easy to draw and visualize) of information about the real estate data viz., plot length and plot width of the house.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://raw.githubusercontent.com/avannaldas/avannaldas.github.io/master/uploads/pca-1.png&quot; alt=&quot;House Plot Length and Width&quot; title=&quot;Original Attributes&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Before doing PCA, the data is normalized by substracting mean and usually scaled, data looks something like this after normalizing&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://raw.githubusercontent.com/avannaldas/avannaldas.github.io/master/uploads/pca-2.png&quot; alt=&quot;House Plot Length and Width Scaled&quot; title=&quot;Normalized data&quot; /&gt;&lt;/p&gt;

&lt;p&gt;PCA identifies two principal components, represented by red and orange lines below.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://raw.githubusercontent.com/avannaldas/avannaldas.github.io/master/uploads/pca-3.png&quot; alt=&quot;Principal Components&quot; title=&quot;Two Principal Components&quot; /&gt;&lt;/p&gt;

&lt;p&gt;In this case, PCA identified an attribute what seems to be analogous to plot area, without we engineering the feature ourselves. It seems little obvious in this case due to the nature of chosen example, but PCA does find dimensions (attributes) that aren’t always obvious to us.&lt;/p&gt;

&lt;p&gt;Now, let’s understand how does PCA work.&lt;/p&gt;

&lt;p&gt;PCA finds a linear transformation which &lt;strong&gt;maximizes variance&lt;/strong&gt;. This is done by minimizing the projection error along the data. This is known as principal component, and the subsequent components are mutually orthogonal. Each principal component is an eigenvector. In the below diagram, green lines are projections from blue data points onto red line, the first principal component. I’ve reduced the number of data points from previous diagram to make it easy to show, as well as draw :), projections.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://raw.githubusercontent.com/avannaldas/avannaldas.github.io/master/uploads/pca-4.png&quot; alt=&quot;Projection Error&quot; title=&quot;Projection error shown with green projections for first principal component&quot; /&gt;&lt;/p&gt;

&lt;p&gt;PCA finds the most important to least important dimensions. So it’s possible that the last/later dimensions have eigen values close to zero. Hence, when we choose &lt;em&gt;k&lt;/em&gt; of the &lt;em&gt;n&lt;/em&gt; dimensions, we get the &lt;em&gt;k&lt;/em&gt; most important dimensions.&lt;/p&gt;

&lt;p&gt;Computing PCA has three main steps…&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;Compute covariance matrix of all the attributes&lt;/li&gt;
  &lt;li&gt;Perform SVD on the covariance matrix computed in step 1&lt;/li&gt;
  &lt;li&gt;Step two returns three matrices viz., &lt;em&gt;U&lt;/em&gt;, &lt;em&gt;S&lt;/em&gt; and &lt;em&gt;V&lt;/em&gt;. Matrix &lt;em&gt;U&lt;/em&gt; is a &lt;em&gt;n&lt;/em&gt; x &lt;em&gt;n&lt;/em&gt; matrix, where &lt;em&gt;n&lt;/em&gt; is the number of total  dimensions/principal components. We choose first &lt;em&gt;k&lt;/em&gt; columns of the matrix, which represent &lt;em&gt;k&lt;/em&gt; dimensions we need.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&quot;dimensionality-reduction-vs-feature-selection&quot;&gt;Dimensionality Reduction vs Feature Selection&lt;/h3&gt;
&lt;p&gt;With PCA we pick &lt;em&gt;k&lt;/em&gt; (most important) dimensions of &lt;em&gt;n&lt;/em&gt; dimensions. &lt;em&gt;k&lt;/em&gt; is a parameter determined based on problem and experience. These &lt;em&gt;k&lt;/em&gt; attributes are optimal to represent the insights, derive correlations and predictions.&lt;/p&gt;

&lt;p&gt;Feature Selection on other hand is picking a subset of all features (and engineered features) of higher importances. Importance can be calculated using different techniques. Some of the popular techniques are available in &lt;a href=&quot;http://scikit-learn.org/stable/modules/feature_selection.html&quot; target=&quot;_blank&quot;&gt;sklearn&lt;/a&gt; and sometimes, the learning algorithm provides the importances of different features.&lt;/p&gt;

&lt;p&gt;These two techniques are very different from each other. While dimensionality reduction finds the best features, they aren’t actual features (attributes) we could relate to, they are all linear transformations of existing features. Hence it’s difficult to understand what drives those predictions and outcomes. On the contrary, with feature selection selection, we have much better understanding of the attributes/features and their significance w.r.t. outcome.&lt;/p&gt;

&lt;p&gt;Thanks for reading, please share your thoughts in comments.&lt;/p&gt;
</description>
        <pubDate>Mon, 13 Nov 2017 00:00:00 +0000</pubDate>
        <link>http://abhijitannaldas.com/ml/dimensionality-reduction-and-principal-component-analysis-pca-explained.html</link>
        <guid isPermaLink="true">http://abhijitannaldas.com/ml/dimensionality-reduction-and-principal-component-analysis-pca-explained.html</guid>
        <!--
        
        
        -->
      </item>
    
      <item>
        <title>DBSCAN Clustering</title>
        <description>&lt;h3 id=&quot;density-based-spatial-clustering-of-applications-with-noise-dbscan&quot;&gt;Density Based Spatial Clustering of Applications with Noise (DBSCAN)&lt;/h3&gt;

&lt;p&gt;DBSCAN is a different type of clustering algorithm with some unique advantages. As the name indicates, this method focuses more on the proximity and density of observations to form clusters. This is very different from KMeans, where an observation becomes a part of cluster represented by nearest centroid. DBSCAN clustering can identify outliers, observations which won’t belong to any cluster. Since DBSCAN clustering identifies the number of clusters as well, it is very useful with unsupervised learning of the data when we don’t know how many clusters could be there in the data.&lt;/p&gt;

&lt;p&gt;K-Means clustering may cluster loosely related observations together. Every observation becomes a part of some cluster eventually, even if the observations are scattered far away in the vector space. Since clusters depend on the mean value of cluster elements, each data point plays a role in forming the clusters. Slight change in data points &lt;em&gt;might&lt;/em&gt; affect the clustering outcome. This problem is greatly reduced in DBSCAN due to the way clusters are formed.&lt;/p&gt;

&lt;p&gt;In DBSCAN, clustering happens based on two important parameters viz.,&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;neighbourhood (n)&lt;/strong&gt; - cutoff distance of a point from (core point – discussed below) for it to be considered a part of a cluster. Commonly referred to as &lt;em&gt;epsilon&lt;/em&gt; (abbreviated as &lt;em&gt;eps&lt;/em&gt;).&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;minimum points (m)&lt;/strong&gt; - minimum number of points required to form a cluster. Commonly referred to as &lt;em&gt;minPts&lt;/em&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There are three types of points after the DBSCAN clustering is complete viz.,&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Core&lt;/strong&gt; - This is a point which has at least &lt;em&gt;m&lt;/em&gt; points within distance &lt;em&gt;n&lt;/em&gt; from itself.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Border&lt;/strong&gt; - This is a point which has at least one Core point at a distance &lt;em&gt;n&lt;/em&gt;.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Noise&lt;/strong&gt; - This is a point which is neither a Core nor a Border. And it has less than &lt;em&gt;m&lt;/em&gt; points within distance &lt;em&gt;n&lt;/em&gt; from itself.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;DBSCAN clustering can be summarized in following steps…&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;For each point &lt;em&gt;P&lt;/em&gt; in dataset, identify points &lt;em&gt;pts&lt;/em&gt; within distance &lt;em&gt;n&lt;/em&gt;.
    &lt;ul&gt;
      &lt;li&gt;if &lt;em&gt;pts&lt;/em&gt; &amp;gt;= &lt;em&gt;m&lt;/em&gt;, label &lt;em&gt;P&lt;/em&gt; as a &lt;em&gt;Core&lt;/em&gt; point&lt;/li&gt;
      &lt;li&gt;if &lt;em&gt;pts&lt;/em&gt; &amp;lt; &lt;em&gt;m&lt;/em&gt; and a core point is at distance &lt;em&gt;n&lt;/em&gt;, label &lt;em&gt;P&lt;/em&gt; a &lt;em&gt;Border&lt;/em&gt; point&lt;/li&gt;
      &lt;li&gt;if &lt;em&gt;pts&lt;/em&gt; &amp;lt; &lt;em&gt;m&lt;/em&gt;, label &lt;em&gt;P&lt;/em&gt; a &lt;em&gt;Noise&lt;/em&gt; point&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;For the sake of explainability, lets refer to &lt;strong&gt;a &lt;em&gt;Core&lt;/em&gt; point and all the points within distance &lt;em&gt;n&lt;/em&gt;&lt;/strong&gt; as a Core-Set. All the overlapping Core-Sets are grouped together into one cluster. Like multiple individual graphs being connected to form a set of connected graphs.&lt;/li&gt;
&lt;/ol&gt;

&lt;p style=&quot;text-align:center&quot;&gt;
&lt;img style=&quot;max-width:100%;&quot; src=&quot;https://github.com/avannaldas/avannaldas.github.io/raw/master/uploads/dbscan.png&quot; /&gt;
&lt;/p&gt;

&lt;p&gt;Since clustering entirely depends on the parameters &lt;em&gt;n&lt;/em&gt; and &lt;em&gt;m&lt;/em&gt; (above), choosing these values correctly is very important. While good domain knowledge of the subject helps choosing good values for these parameters, there are also some approaches where these parameters can be fairly approximated without deep expertise in the domain.&lt;/p&gt;

&lt;p&gt;See DBSCAN demo in &lt;a href=&quot;http://scikit-learn.org/stable/auto_examples/cluster/plot_dbscan.html&quot; target=&quot;_blank&quot;&gt;sklearn examples&lt;/a&gt; and try it with &lt;a href=&quot;http://scikit-learn.org/stable/modules/generated/sklearn.cluster.DBSCAN.html&quot; target=&quot;_blank&quot;&gt;sklearn.cluster.DBSCAN&lt;/a&gt; in sklearn.&lt;/p&gt;

</description>
        <pubDate>Fri, 20 Oct 2017 00:00:00 +0000</pubDate>
        <link>http://abhijitannaldas.com/ml/dbscan-clustering-in-machine-learning.html</link>
        <guid isPermaLink="true">http://abhijitannaldas.com/ml/dbscan-clustering-in-machine-learning.html</guid>
        <!--
        
        
        -->
      </item>
    
      <item>
        <title>K-Means vs KNN</title>
        <description>&lt;h1 id=&quot;k-means-vs-knn&quot;&gt;K-Means vs KNN&lt;/h1&gt;

&lt;p&gt;K-Means (K-Means Clustering) and KNN (K-Nearest Neighbour) are often confused with each other in Machine Learning. In this post, I’ll explain some attributes and some differences between both of these popular Machine Learning techniques.
&lt;br /&gt;&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;K-Means&lt;/th&gt;
      &lt;th&gt;KNN&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;It is an &lt;strong&gt;Unsupervised&lt;/strong&gt; learning technique&lt;/td&gt;
      &lt;td&gt;It is a &lt;strong&gt;Supervised&lt;/strong&gt; learning technique&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;It is used for &lt;strong&gt;Clustering&lt;/strong&gt;&lt;/td&gt;
      &lt;td&gt;It is used mostly for &lt;strong&gt;Classification&lt;/strong&gt;, and sometimes even for &lt;strong&gt;Regression&lt;/strong&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;‘K’ in K-Means is the number of clusters the algorithm is trying to identify/learn from the data. The clusters are often unknown since this is used with Unsupervised learning.&lt;/td&gt;
      &lt;td&gt;‘K’ in KNN is the number of nearest neighbours used to classify or (predict in case of continuous variable/regression) a test sample&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;It is typically used for scenarios like understanding the population demomgraphics, market segmentation, social media trends, anomaly detection, etc. where the clusters are unknown to begin with.&lt;/td&gt;
      &lt;td&gt;It is used for classification and regression of known data where usually the target attribute/variable is known before hand.&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;In training phase of K-Means, K observations are arbitrarily selected (known as centroids). Each point in the vector space is assigned to a cluster represented by nearest (euclidean distance) centroid. Once the clusters are formed, for each cluster the centroid is updated to the mean of all cluster members. And the cluster formation restarts with new centroids. This repeats until the centroids themselves become mean of clusters, i.e., when updating centroids to mean doesn’t change them. The prediction of a test observation is done based on nearest centroid.&lt;/td&gt;
      &lt;td&gt;K-NN doesn’t have a training phase as such. But the prediction of a test observation is done based on the K-Nearest (often euclidean distance) Neighbours (observations) based on weighted averages/votes.&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;&lt;br /&gt;
&lt;i&gt;You can find a bare minimum KMeans algorithm implementation from scratch &lt;a href=&quot;https://github.com/avannaldas/ML-from-scratch/blob/master/avlearn/cluster.py&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;.&lt;/i&gt;
&lt;br /&gt;&lt;br /&gt;
&lt;i&gt;Learn more about &lt;a href=&quot;https://en.wikipedia.org/wiki/K-means_clustering&quot; target=&quot;_blank&quot;&gt;K-Means Clustering&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/K-nearest_neighbors_algorithm&quot; target=&quot;_blank&quot;&gt;K-Nearest Neighbors&lt;/a&gt;&lt;/i&gt;&lt;/p&gt;
</description>
        <pubDate>Sat, 23 Sep 2017 00:00:00 +0000</pubDate>
        <link>http://abhijitannaldas.com/ml/kmeans-vs-knn-in-machine-learning.html</link>
        <guid isPermaLink="true">http://abhijitannaldas.com/ml/kmeans-vs-knn-in-machine-learning.html</guid>
        <!--
        
        
        -->
      </item>
    
      <item>
        <title>Data preprocessing in Machine Learning</title>
        <description>&lt;p&gt;Data preprocessing is an important step of solving every machine learning problem. Most of the datasets used with Machine Learning problems need to be processed / cleaned / transformed so that a Machine Learning algorithm can be trained on it. Most commonly used preprocessing techniques are very few like - missing value imputation, encoding categorical variables, scaling, etc. These techniques are easy to understand. But when we actually deal with the data, things often get clunky. Every dataset is different and poses unique challenges.&lt;/p&gt;

&lt;p&gt;In this post, I’m not explaining preprocessing techniques, but sharing a few tips based on my experiences.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;Too many nulls - When most (over 60% to 70%) of the values in a column are null, it’s better to drop the column. This percentage/threshold can be decided based on problem and experience.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Same values/skew - Sometimes, a majority of values in a column might be same values with very few different values. We need to check if the occurrence of such values is due to a skew in dataset or is it natural for that dataset. If it’s skewed, dataset should be resampled (sub-sample or over-sample, as appropriate). If it’s not a skew and the values occur naturally in that way, it’s better to drop the column.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Data types - Check the datatypes of the columns, particularly date columns and type cast appropriately.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Missing value imputation - Usually median is used with numeric columns and mode with non-numeric columns.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;When column doesn’t have missing values - It’s possible that a column doesn’t have any null values in the train dataset, but it’s very possible that it might have null values in test dataset. Hence, it’s important to review the columns/data and perform missing value imputation of all columns that can possibly have missing values, even if the train dataset doesn’t have any missing values.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;Categorical Attributes -
    &lt;ul&gt;
      &lt;li&gt;When the number unique values in a categorical column are too high, check the value counts of each of those values. Replace rarely occurring values together into a single value like ‘Other’ before encoding.&lt;/li&gt;
      &lt;li&gt;When number of unique values is huge and even the values are equally distributed, try to find some related values and see if the multiple categorical values can be clubbed into single (grouping), thereby reducing the count of categorical values.&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;Related Attributes - If there multiple attributes with same information with different granularity, like city and state, it’s better to keep columns like state and delete city column. Additionally, keeping both columns and assessing feature importance might help in eliminating one column.&lt;/li&gt;
&lt;/ul&gt;

&lt;p style=&quot;text-align:center&quot;&gt;&lt;img src=&quot;https://github.com/avannaldas/avannaldas.github.io/raw/master/uploads/Label-Encoder-vs-One-Hot-Encoder.png&quot; alt=&quot;alt text&quot; title=&quot;LabelEncoder vs OneHotEncoder&quot; style=&quot;max-width:850px&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Machine Learning Practitioners/Data Scientists - Please share your thoughts, anything you wanna add or do differently/better.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
</description>
        <pubDate>Fri, 08 Sep 2017 00:00:00 +0000</pubDate>
        <link>http://abhijitannaldas.com/ml/data-preprocessing-in-machine-learning.html</link>
        <guid isPermaLink="true">http://abhijitannaldas.com/ml/data-preprocessing-in-machine-learning.html</guid>
        <!--
        
        
        -->
      </item>
    
      <item>
        <title>Machine Learning - Beyond the buzz!</title>
        <description>&lt;p&gt;Machine Learning and Data Science is one of the hottest topics of all the disciplines these days. It has created a lot of interest among the people. Machine Learning has immense potential and we keep seeing a lot of jaw dropping accomplishments day by day. Here I’ll share my understanding of the field and what would it take to make a career in Machine Learning/Data Science. I am hoping that this can be of little help in taking the important decision about the career.&lt;/p&gt;

&lt;p&gt;The hype of the topic to some extent is true. The hype and all the buzz shouldn’t be a trigger to choose Machine Learning as a career option. The buzz and the glamour that pulls one into the field soon fades away as soon as he/she gets the feet wet in Machine Learning unless there is a strong objective/goal that Machine Learning will help achieve. Choosing/making a career in Machine Learning shouldn’t be the objective in itself.&lt;/p&gt;

&lt;p&gt;I first heard about Machine Learning 3 years ago and I didn’t see any compelling reason at that point of time to seriously consider the field. In early 2016, I came to know about something which forever changed what Machine Learning means to me. I read about diagnosing diabetic retinopathy from retina images using Machine Learning. That was a wow moment for me. I saw immense potential of doing great work, positively impacting people’s lives which is visible first hand, so direct and close from the work I can do. The mere thought that Machine Learning cuts across multiple fields, disciplines and different walks of life is fascinating to me. That’s when I became serious about Machine Learning.&lt;/p&gt;

&lt;p&gt;Once you have a solid reason and a goal, below is a short one liner depiction of the path to Machine Learning mastery. Though shortcuts may be taken from time to time, every shortcut will have it’s own cost which will need to be paid by taking a break and coming back to learning. Honestly, I’m yet to complete my first iteration of the loop even after almost 18 months.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Linear Algebra -&amp;gt; Calculus -&amp;gt; Probability -&amp;gt; Statistics -&amp;gt; Statistical Learning Theory -&amp;gt; Optimization Techniques -&amp;gt; Machine Learning/Deep Learning -&amp;gt; Programming Language -&amp;gt; Data Preprocessing, Analysis and Exploratory Data Analysis -&amp;gt; Mastering Machine Learning/Deep Learning libraries/frameworks -&amp;gt; relentless practice -&amp;gt; keeping up with the advancements -&amp;gt; loop back to the topic that you realize you need to revisit.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If you are at a juncture where you are thinking of career options, here’s my advice. Assess yourself, you are the best person to evaluate for yourself what you can do. You don’t have to go by the hype and ride the same wave everyone is. You can achieve mastery, do great work, make a lasting impact on the world, be proud of yourself and make your loved ones proud of you in any field. It need not be Machine Learning (or any hottest happening). Some of the fields that I think are going to be big…&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;Clean Energy - Global warming, depleting fossil fuels, increasing energy needs and a lot of other problems have one common solution - clean energy.&lt;/li&gt;
  &lt;li&gt;Quantum Computing - Once this is a reality, everything is gonna change. All the equations of the (tech) life we take for granted today will be turned upside down.&lt;/li&gt;
  &lt;li&gt;Health, Fitness, Diet and Nutrition - This will only become more and more important day by day.&lt;/li&gt;
  &lt;li&gt;Agricultural Advancements - with changing weather, water and ecological landscape, it’s important to evolve techniques of agriculture.&lt;/li&gt;
&lt;/ul&gt;
</description>
        <pubDate>Sun, 03 Sep 2017 00:00:00 +0000</pubDate>
        <link>http://abhijitannaldas.com/ml/machine-learning-beyond-the-buzz.html</link>
        <guid isPermaLink="true">http://abhijitannaldas.com/ml/machine-learning-beyond-the-buzz.html</guid>
        <!--
        
        
        -->
      </item>
    
      <item>
        <title>Installing Tensorflow-GPU on Windows</title>
        <description>&lt;p&gt;To use tensorflow library on GPU, NVIDIA CUDA Toolkit and cuDNN libraries need to be first installed. Installing &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tensorflow-gpu&lt;/code&gt; is straight forward. Installing the NVIDIA CUDA Toolkit and cuDNN is slightly tricky, we need to ensure a couple of things so that CUDA toolkit works that tensorflow-gpu uses under the hood.&lt;/p&gt;

&lt;p&gt;Let’s begin…&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Download &lt;a href=&quot;https://developer.nvidia.com/cuda-downloads&quot; target=&quot;_blank&quot;&gt;CUDA Toolkit 8.0&lt;/a&gt; and &lt;a href=&quot;https://developer.nvidia.com/cudnn&quot; target=&quot;_blank&quot;&gt;cuDNN v5.1 for CUDA Toolkit 8.0&lt;/a&gt; from NVIDIA Developer portal&lt;/li&gt;
  &lt;li&gt;Install CUDA Toolkit 8.0
    &lt;ul&gt;
      &lt;li&gt;Sometimes if the GPU is a latest one, CUDA Toolkit may not have support for it. This shouldn’t stop you from using CUDA Tookit, but the CUDA Toolkit installation warns that it couldn’t find a compatible GPU Hardware. In that case, go for a custom installation and choose not to install the drivers. Should be easy to identify in the custom install screen.&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;Copy the contents of the cuDNN downloaded archive into CUDA Toolkit installed folder.&lt;/li&gt;
  &lt;li&gt;Add below two paths to the system ‘PATH’ environment variable (if CUDA Toolkit installation didn’t add it):
    &lt;ul&gt;
      &lt;li&gt;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\lib\x64&lt;/li&gt;
      &lt;li&gt;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\extras\CUPTI\libx64&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;Ensure below three environment variables are available with value &lt;em&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0&lt;/code&gt;&lt;/em&gt; or wherever the CUDA toolkit is installed. Create the missing variables.
    &lt;ul&gt;
      &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CUDA_HOME&lt;/code&gt; - this needs to be added manually&lt;/li&gt;
      &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CUDA_PATH&lt;/code&gt; - this is usually created after installing CUDA Toolkit 8.0&lt;/li&gt;
      &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CUDA_PATH_V8_0&lt;/code&gt; - this is usually created after installing CUDA Toolkit 8.0&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;Installing &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tensorflow-gpu&lt;/code&gt;
    &lt;ul&gt;
      &lt;li&gt;If tensorflow package without gpu support is installed, uninstall it.&lt;/li&gt;
      &lt;li&gt;Install tensorflow-gpu using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pip install tensorflow-gpu&lt;/code&gt; OR &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;conda install tensorflow-gpu&lt;/code&gt; (if using anaconda). If already installed, uninstall it and then reinstall. It didn’t work for me until I reinstalled.&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;If &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tflearn&lt;/code&gt; is required, install it with one of the below commands
    &lt;ul&gt;
      &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pip install tflearn&lt;/code&gt;&lt;/li&gt;
      &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;conda install -c derickl tflearn&lt;/code&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can find the official tensorflow documentation guide for tensorflow-gpu setup &lt;a href=&quot;https://www.tensorflow.org/install/install_windows#requirements_to_run_tensorflow_with_gpu_support&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

</description>
        <pubDate>Thu, 17 Aug 2017 00:00:00 +0000</pubDate>
        <link>http://abhijitannaldas.com/ml/installing-tensorflow-gpu-on-windows.html</link>
        <guid isPermaLink="true">http://abhijitannaldas.com/ml/installing-tensorflow-gpu-on-windows.html</guid>
        <!--
        
        
        -->
      </item>
    
      <item>
        <title>Learning from my first kaggle competition</title>
        <description>&lt;p&gt;My first Kaggle competition &lt;a href=&quot;https://www.kaggle.com/c/instacart-market-basket-analysis/&quot; target=&quot;_blank&quot;&gt;Instacart Market Basket Analysis&lt;/a&gt; has concluded. Though my ranking wasn’t impressive, I’ve learned a lot in this competition, from everyone. I’m happy that I know quite a few things after this competition.&lt;/p&gt;

&lt;p&gt;Here are few things I learned in this competition. I’ve missed some of these this time, hoping to do better on next time.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Begin with understanding data and then spend maximum time on feature engineering initially. Start with a notebook and pen. Hoping to leave no stone unturned. Feature engineering is something that should never need more time at later point of time. Though feature engineering ideas can come at any point of time, in my opinion separating this crucial step as first milestone helps in concentrating on building final solution. Validate the merges/joins are happening the way they are intended to happen.&lt;/li&gt;
  &lt;li&gt;It’s important to use the correct evaluation metric during the model training.&lt;/li&gt;
  &lt;li&gt;Use the cross validation strategy (when) available natively with the library rather than doing it separately.&lt;/li&gt;
  &lt;li&gt;Don’t use small early stopping for XGBoost, LightGBM, etc.&lt;/li&gt;
  &lt;li&gt;Always keep one more held out set apart from the cross validation set used with model training, cross validation scoring. Score on different metrics with held out set.&lt;/li&gt;
  &lt;li&gt;Keep training iterations (n_estimators, epochs) small, a little bigger learning rate when just evaluating results/improvement locally, saves a lot of time. Can be fine tuned when required.&lt;/li&gt;
  &lt;li&gt;Create a custom data loader for large datasets which can load appropriately sampled train and multiple evaluation datasets specified in percentage, can be very useful when playing around with different models and approaches with such large datasets. This was my biggest roadblock as I was working towards the end of competition with such huge dataset. Sampling smaller dataset would have saved a lot of time. When working on such huge datasets its easy to exhaust even 32GB RAM.&lt;/li&gt;
  &lt;li&gt;Work on two different approaches simultaneously if it’s gonna take a large amount of time to train.&lt;/li&gt;
  &lt;li&gt;When writing a submission file, always write a text file with the details like model, parameters and details that help you reproduce it (I once hit the logloss of 0.20+ but wasn’t able to reproduce it again).&lt;/li&gt;
  &lt;li&gt;Feature importance and feature selection are different for algorithm (like what LightGBM thinks is important may not be true with XGBoost) hence Feature selection (elimination) should be based on the model/algorithm.&lt;/li&gt;
  &lt;li&gt;To gain the most out of the competition, it helps to focus on learning one thing. In this competition, the solution could have been a time-series based, based on Deep Neural Network, based on ensembling techniques, based on feature engineering, etc. Focusing on learning one thing may not win the competition but eventually leads to invaluable learning of something new. In this competition, I focused on stacking multiple models, feature selection and hyper-parameter tuning. These things didn’t give me a good rank in the competition but I learned those things.&lt;/li&gt;
&lt;/ul&gt;
</description>
        <pubDate>Tue, 15 Aug 2017 00:00:00 +0000</pubDate>
        <link>http://abhijitannaldas.com/ml/learning-from-my-first-kaggle-competition.html</link>
        <guid isPermaLink="true">http://abhijitannaldas.com/ml/learning-from-my-first-kaggle-competition.html</guid>
        <!--
        
        
        -->
      </item>
    
      <item>
        <title>Significance of Interpretable Predictive Models</title>
        <description>&lt;p&gt;Humans are have curious minds. We often tend to ask why something is the way it is. It’s an innate quality that helps us understand things around, learn and grow.&lt;/p&gt;

&lt;p&gt;In Machine Learning, when a predictive model (or a machine learning model) predicts something, we usually only get a confidence level associated with prediction in terms of probability. And beyond this, most of the predictive models aren’t very explaining in nature. Every predictive algorithm answers &lt;em&gt;What?&lt;/em&gt; but most of them miss on answering &lt;em&gt;How?&lt;/em&gt; and &lt;em&gt;Why?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Let us consider a problem of predicting a returning customer in a context of a business which sells personal computers, peripherals and accessories. The machine learning model is built on the past data comprising of details about customer transactions, demographics, etc. The model is built to predict if a customer will return to buy certain products. To come to this conclusion, the model first finds patterns (training phase) within the sample data (training dataset). When the model is used to predict for an unseen customer, the model finds which learned patterns does the unseen customer match with. Lets consider one unseen customer C’s case…&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;[Input] C has purchased an ultra-notebook that is typically bought by frequent travelling professionals {consider, we have all details like, order date, configuration, etc.}&lt;/li&gt;
  &lt;li&gt;[Prediction] Customer C will be a returning customer, and he will buy product P.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;From the above case, even if we know the complete details of customer C (which aren’t included here for simplicity), like PC configuration, order details, date, cost, etc. we won’t be able to make it out why would customer C return and buy product P.&lt;/p&gt;

&lt;p&gt;If the business knows what does it take (patterns learned by model) for a customer to return and buy product P, it could be of an incredible value. Business can take decisions which will turn more customers into returning customers. Without that, all that the business can do is just maintain inventory for predicted demand or carry out targeted marketing. If we see the magnitude of impact here, predictions help en-cash on the returning customers, and on the other hand learned insights help business to retain more customers.&lt;/p&gt;

&lt;p&gt;In this case, the underlying patterns and what model learned can be visualized in the form of a decision tree explaining a series of events/criteria that led to this outcome, or at a much higher level, giving out reasoning in natural language.&lt;/p&gt;

&lt;p&gt;Predictive models today are interpretable to a varied extent, based on the nature of underlying model. Some of the models aren’t interpretable at all, like deep neural networks.&lt;/p&gt;
</description>
        <pubDate>Fri, 21 Jul 2017 00:00:00 +0000</pubDate>
        <link>http://abhijitannaldas.com/ml/significance-of-interpretable-predictive-models.html</link>
        <guid isPermaLink="true">http://abhijitannaldas.com/ml/significance-of-interpretable-predictive-models.html</guid>
        <!--
        
        
        -->
      </item>
    
      <item>
        <title>Pondering about Artificial General Intelligence</title>
        <description>&lt;p&gt;Researchers in the field of Machine Learning and Artificial Intelligence are relentlessly working in a quest to solve intelligence, build Artificial General Intelligence aka Strong Artificial Intelligence. And we see progress every once in a while as we witness jaw dropping feats accomplished by intelligent systems built at various industrial and academic research labs. Two such feats are, an &lt;a href=&quot;https://blogs.microsoft.com/next/2017/06/14/divide-conquer-microsoft-researchers-used-ai-master-ms-pac-man&quot; target=&quot;_blsnk&quot;&gt;AI system which mastered PAC MAN&lt;/a&gt; and the &lt;a href=&quot;https://en.wikipedia.org/wiki/AlphaGo&quot; target=&quot;_blank&quot;&gt;Alpha Go&lt;/a&gt; beating a human expert at the game of Go.&lt;/p&gt;

&lt;p&gt;Some recent feats in AI systems are making great progress towards solving intelligence. If we would have thought about such breakthroughs a few years ago, probably we would have considered such AI systems to be an Artificial General Intelligence back then. Every breakthrough brings a lot of learnings and opens new possibilities. When researchers find answers, they also find new questions. The solution to such great problems is usually built on the mathematical and scientific principles/concepts that have been around for quite some time. Once such breakthroughs/feats are achieved, new knowledge/expertise is within reach and it isn’t seen as Artificial General Intelligence because we know we aren’t there yet. But, we don’t know how far we are from solving Intelligence. Hence solving intelligence appears to be a target that is moving farther.&lt;/p&gt;

&lt;p&gt;I’ve been thinking of &lt;strong&gt;what would qualify as an Artificial General Intelligence and will it come from the fundamental sciences that are yet to be invented or discovered?&lt;/strong&gt; There must be field of study that we are yet to discover which spans across mathematics, computer science, neurosciences, cognitive science, statistics, probability, linguistics, etc. It has been proven that humans, even in toddlers stage, tend to demonstrate qualities that are studied in depth across these subjects. There has been a lot of work put into understanding how a babies’ brain works, how they learn and grow. Children are the best manifestation of acquiring intelligence, which is exactly what Artificial General Intelligence is supposed to do. Children demonstrate the best way of learning. Period. Nothing else beats the evolutionary growth. This brings me to a thought that probably intelligence can be solved by understanding about babies brain development without constraining our self to one field of research. We should see understanding human intelligence and reproducing it as an interdisciplinary research, not as research area in AI, neurosciences, statistics, probability, etc. individually.&lt;/p&gt;

&lt;p&gt;Here are few references/talks about how children think. Be ready to be awe inspired if you haven’t explored this area before…&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.ted.com/talks/alison_gopnik_what_do_babies_think&quot; target=&quot;_blank&quot;&gt;What do babies think - Alison Gopnik - Ted Talk&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.ted.com/talks/laura_schulz_the_surprisingly_logical_minds_of_babies&quot; target=&quot;_blank&quot;&gt;The surprisingly logical minds of babies - Laura Schulz - Ted Talk&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.ted.com/talks/patricia_kuhl_the_linguistic_genius_of_babies&quot; target=&quot;_blank&quot;&gt;The linguistic genius of babies - Patricia Kuhl - Ted Talk&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.slate.com/articles/health_and_science/science/2012/10/how_do_children_learn_so_quickly_bayesian_statistics_and_probabilities_help.html&quot; target=&quot;_blank&quot;&gt;Why Your 4-Year-Old Is As Smart as Nate Silver&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
        <pubDate>Wed, 19 Jul 2017 00:00:00 +0000</pubDate>
        <link>http://abhijitannaldas.com/ml/pondering-about-artificial-general-intelligence.html</link>
        <guid isPermaLink="true">http://abhijitannaldas.com/ml/pondering-about-artificial-general-intelligence.html</guid>
        <!--
        
        
        -->
      </item>
    
      <item>
        <title>Intuition Behind Encoded Vector Representation</title>
        <description>&lt;p&gt;In this post I will share the intuition behind the encoded vectors, like One Hot Encoding used for categorical variables and word embeddings used to represent words in Natural Language Processing. We always represent non-numeric data in terms of vectors for very obvious reason. Non-numeric values cannot be used in the computations required to learn/predict the patterns with Machine Learning.&lt;/p&gt;

&lt;p&gt;These computations are almost always about operations on vectors in multi-dimensional space (hyperspace). All the attributes of the data need to be represented using numeric values in the form of a vector. Sometimes when the attribute is not numeric in nature, doesn’t have a magnitude/scale or anything such sort of, we encode the values in terms of vectors.&lt;/p&gt;

&lt;p&gt;Categorical values would be encoded as one hot vector, in other words it is a unit-vector pointing along only one axis/dimension in the hyperspace. On the other hand, a single encoded word embedding is a vector (may nor may not be a unit-vector) which usually points into hyperspace based on the dimensions it represents. For example, if dimensions are animal, pet, fur, etc. dog and cat could be represented using similar or same vectors based on the word embedding strategy. If it is representing a single word in vocabulary, it can be a unit-vector pointing along a single axis the word is represented by.&lt;/p&gt;

&lt;p&gt;Two things happen when non-numeric values are encoded. First, the encoded attribute adds new dimensions to the hyperspace equal to the number of all possible distict values the attribute it is encoding. Secondly, these vectors help in clustering together similar observations (records) as they affect the representation of an observation in hyperspace.&lt;/p&gt;

&lt;p&gt;Every encoding adds multiple dimensions to the hyperspace the problem is being solved in. Every encoding adds to the level of complexity. To make it explicit, imagine a number-line. Add a dimension, it’s an X-Y plane. Add one more dimension, it’s an X-Y-Z space. Add one more dimension, and it’s a hyperspace. Beyond this it’s hard to intuitively imagine the representation of an hyperspace. And it adds to the complexity of solving a problem. It goes without saying that we should exercise caution while adding encoded representations.&lt;/p&gt;

&lt;p&gt;This post is a result of sudden realization of the intuition behind encoded vector representation. These thoughts are all about how I understand this. I could be incorrect. Please let me know what do you think in comments. Your comments will help anyone who lands here, including me. It’s all about learning from each other, isn’t it?&lt;/p&gt;
</description>
        <pubDate>Wed, 05 Jul 2017 00:00:00 +0000</pubDate>
        <link>http://abhijitannaldas.com/ml/intuition-behind-encoded-vector-representation.html</link>
        <guid isPermaLink="true">http://abhijitannaldas.com/ml/intuition-behind-encoded-vector-representation.html</guid>
        <!--
        
        
        -->
      </item>
    
      <item>
        <title>Applied vs Theoretical Machine Learning</title>
        <description>&lt;p&gt;One can approach learning Machine Learning in one of the two ways viz., Applied Machine Learning and Theoretical Machine Learning. Both the paths are very different and empower an individual in different ways to make a difference/solve problems.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Applied Machine Learning is about understanding the Machine Learning concepts at an abstract level sufficient enough to solve problems using machine learning (applying machine learning). This involves gaining expertise in using the tools and libraries which implement the Machine Learning Algorithms at their core.&lt;/li&gt;
  &lt;li&gt;Theoretical Machine Learning on the other hand is about understanding the underlying algorithms, mathematics, probability theory, statistics and definitely a lot of other subjects/concepts at the fundamental level.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4 id=&quot;applied-machine-learning&quot;&gt;Applied Machine Learning&lt;/h4&gt;
&lt;p&gt;Applied machine learning is about solving real world problems. This is where the potential and impact of new inventions/discoveries made through advancements in theoretical machine learning are realized. It’s all about data, seeing a difference in the lives of people first hand. Once a person understands basics of machine learning and the big main concepts, he/she can get started with applied machine learning. Expertise in applied machine comes with practice and solving problem after problem. It takes understanding of the data, the challenge a person/institution/society is facing. It is motivating to see the results relatively quicker as one solves a problem after problem.&lt;/p&gt;

&lt;h4 id=&quot;theoretical-machine-learning&quot;&gt;Theoretical Machine Learning&lt;/h4&gt;
&lt;p&gt;While Theoretical Machine Learning is exciting to learn, it is much more vast than applied machine learning at an uber level when one begins learning. As one studies, the subjects/concepts will touch base with many other concepts and subjects. Every new piece of theoretical study might come with things that might need double clicking to understand further. It ellicits curiosity to learn more and intimidates at the same time. In the initial stages, it’ll leave the learner with a feeling of not knowing a lot of things, which is true. In case of theoretical machine learning, the path (well, it’s a graph :)) is long and needs a lot of learning, before picking a particular subject/area to dive deeper to gain further expertise/specialization.&lt;/p&gt;

&lt;p&gt;With Theoretical Machine Learning, the rewards (read as satisfaction/results/problem solving) might be slow but are very satisfying when achieved. One might invent an new algorithm or improve ways of doing things. The new discoveries/inventions may be realized as speeding up existing solutions, solutions to unsolved problems, etc. In other words, it opens up door to possibilities to be realized with applying the new inventions (applied machine learning).&lt;/p&gt;

&lt;p&gt;I’m trying to strike a balance between learning theoretical and applied machine learning. Both the approaches excite me equally, albeit in different ways. Applied Machine Learning excites because I am able to see the results of my work quicker/first hand. And Theoretical Machine Learning gives me a sense of satisfaction of knowing something new at the end of the day (though I may or may not pursue the research path in long run). If you are aware of reinforcement learning, the problem I’m facing can be aptly put as &lt;em&gt;exploration (theoretical machine learning) versus exploitation (applied machine learning) dilemma&lt;/em&gt; :)&lt;/p&gt;

&lt;p&gt;If you are a self taught (or just beginning) data scientist, you will understand that there are times when you would be on full throttle (read as doing/seeing results/learning a lot) and there would be times when things aren’t moving as fast. You may be left with a feeling of wasting a lot of time, you aren’t making any progress, you might be reading/learning something which might feel irrelevant to you as you learn. I’ve been through such times and I guess that might happen again. There would be ups and downs, it’s not easy to build an expertise in such a field keeping the day job. And never, ever think if it’s all worth it! When things aren’t moving, just give it some time and hang on during difficult times. Get back on track, every time you feel derailed!&lt;/p&gt;

&lt;p&gt;Last but not least, these are just my views coming directly from my heart. I don’t mean one is superior to other, or one is lot of hard work, rewarding, satisfying over other. Both are equally important and both need each other.&lt;/p&gt;

&lt;p&gt;Machine Learning Practitioners and Researchers, please share your valuable advice/inputs in comments…&lt;/p&gt;
</description>
        <pubDate>Wed, 21 Jun 2017 00:00:00 +0000</pubDate>
        <link>http://abhijitannaldas.com/ml/applied-vs-theoretical-machine-learning.html</link>
        <guid isPermaLink="true">http://abhijitannaldas.com/ml/applied-vs-theoretical-machine-learning.html</guid>
        <!--
        
        
        -->
      </item>
    
      <item>
        <title>Introduction to Ensemble Learning Methods in ML</title>
        <description>&lt;p&gt;Machine Learning is advancing at a rapid pace day by day. It never ceases to surprise with newer breakthroughs from time to time. Be it IBM Watson’s jeopardy win or a recent win of DeepMind’s Alpha Go over a human expert in the game of Go. It is certainly the next revolution in the history of mankind after industrial revolution. Andrew Ng, best known for his introductory Machine Learning course, has rightly said - AI is the new electricity! It comes with unimaginable opportunities, only to be discovered by time.&lt;/p&gt;

&lt;p&gt;Many data science competition winning solutions nowadays are built using techniques known as Ensemble Learning. Dictionary meaning of Ensemble is a &lt;em&gt;group&lt;/em&gt;. Likewise in Machine Learning, Ensemble refers to multiple (different) Machine Learning models working together as a group. In real life too, we know that a group is always intelligent than an individual. It’s a quite natural to believe a piece of information that comes from multiple sources. We do look for multiple opinions at times in real life when one expert opinion isn’t convincing enough for us to act upon. It’s somewhat similar idea in Machine Learning.&lt;/p&gt;

&lt;p&gt;While any type of Machine Learning algorithms can be used with ensembling techniques, most often, some form of Decision Trees and/or random forests are used with ensembling techniques. In this post, we’ll go through a quick introduction of Information Entropy, Decision Trees and popular ensemble techniques.&lt;/p&gt;

&lt;h4 id=&quot;decision-tree-and-information-entropy&quot;&gt;&lt;strong&gt;Decision Tree and Information Entropy&lt;/strong&gt;&lt;/h4&gt;
&lt;p&gt;Entropy is a measure of impurity/noise in data. When we navigate through the data reducing noise to find a piece of information/truth, we say that we have reached a pure form of data, meaning zero entropy.&lt;/p&gt;

&lt;p&gt;Say for example we have data of all flight departures from a particular airport for last one year. Data like - airline carrier, departure gate, departure time, aircraft model and delayed. There could be many more, but let’s consider these for now. Now, given this information for future flights, we would want to predict if the aircraft was &lt;em&gt;delayed&lt;/em&gt;. The existing data in our case has some entropy. And when we segregate the data into two buckets based on whether the flight was delayed, we can say we have data with zero impurity in this particular case.&lt;/p&gt;

&lt;p&gt;It might seem straight foward to identify items in these two buckets, just split based on whether the flight was &lt;em&gt;delayed&lt;/em&gt;. But the point here is, for future flights that piece of information would be missing we cannot do this split easily due to the information impurity (entropy).&lt;/p&gt;

&lt;p&gt;We use decision trees to uncover the circumstances in which the flight was delayed, though we don’t have &lt;em&gt;delayed&lt;/em&gt; information, we do have information (other fields) which gives some idea of &lt;em&gt;delayed&lt;/em&gt;. To give a quick idea of how decision trees do it, consider this, we notice that 8 in every 10 flights departed from a particular gate were delayed (may be because of the airport plan and gate’s location). Now, if we make two buckets based on whether the flight departure was from that particular gate or not, we have a bucket where 80% of flights will possibly be delayed and while we don’t know much about the other bucket. This additional information that we uncovered is known as information gain (reduction in entropy). And when for future flight departures from that particular gate, we know that there is an 80% chance that the flight would be delayed. Decision trees learn to ask the right questions in the right order to identify items in these buckets as fast as possible, i.e., maximizing information gain (entropy reduction) in least possible steps (questions/splits). With every split, decision tree knows the probabiliy of each outcome (delayed or not delayed) for both the branches of the split. Usually these set (or more correctly, sequence) of questions (conditions identified) generalize so as to predict fairly accurate for future flights.&lt;/p&gt;

&lt;h4 id=&quot;ensemble-methods&quot;&gt;&lt;strong&gt;Ensemble Methods&lt;/strong&gt;&lt;/h4&gt;
&lt;p&gt;Some of the common Ensemble Learning techniques are…&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Bagging&lt;/strong&gt;: Trains on a subset of samples iteratively and results are combined. The results can be combined in many ways, for instance a majority vote for classification and average for regression. Learn more &lt;a href=&quot;https://en.wikipedia.org/wiki/Bootstrap_aggregating&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Boosting&lt;/strong&gt;: Trains iteratively, each time improving prediction on previous misclassified observations. Learn more &lt;a href=&quot;https://en.wikipedia.org/wiki/Boosting_(machine_learning)&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Stacking&lt;/strong&gt;: Multiple algorithms are trained and the outputs (predictions) become features for the final model, sometimes referred to as meta learner. Learn more &lt;a href=&quot;https://en.wikipedia.org/wiki/Ensemble_learning#Stacking&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h4 id=&quot;further-learning&quot;&gt;Further Learning&lt;/h4&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.khanacademy.org/computing/computer-science/informationtheory&quot; target=&quot;_blank&quot;&gt;Information Theory&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Entropy_(information_theory)&quot; target=&quot;_blank&quot;&gt;Information Entropy&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Information_gain_in_decision_trees&quot; target=&quot;_blank&quot;&gt;Information Gain&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Ensemble_learning&quot; target=&quot;_blank&quot;&gt;Ensemble Learning&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://xgboost.readthedocs.io/en/latest/&quot; target=&quot;_blank&quot;&gt;XGBoost&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/Microsoft/LightGBM&quot; target=&quot;_blank&quot;&gt;LightGBM&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://docs.h2o.ai/h2o/latest-stable/h2o-docs/data-science/gbm.html&quot; target=&quot;_blank&quot;&gt;H2O&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.import.io/post/how-to-win-a-kaggle-competition/&quot; target=&quot;_blank&quot;&gt;Blog post about winning Kaggle competitions&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4 id=&quot;mentioned-in-post&quot;&gt;Mentioned in post&lt;/h4&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Watson_(computer)#Jeopardy.21&quot; target=&quot;_blank&quot;&gt;IBM Watson winning jeopardy&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/AlphaGo&quot; target=&quot;_blank&quot;&gt;AlphaGo&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Andrew_Ng&quot; target=&quot;_blank&quot;&gt;Andrew Ng&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.coursera.org/learn/machine-learning&quot; target=&quot;_blank&quot;&gt;Andrew Ng’s Machine Learning Course&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://twitter.com/andrewyng/status/735874952008589312?lang=en&quot; target=&quot;_blank&quot;&gt;AI is the new electricity!&lt;/a&gt; tweet by Andrew Ng&lt;/li&gt;
&lt;/ul&gt;

</description>
        <pubDate>Sat, 03 Jun 2017 00:00:00 +0000</pubDate>
        <link>http://abhijitannaldas.com/ml/introduction-to-ensemble-learning-methods-in-ml.html</link>
        <guid isPermaLink="true">http://abhijitannaldas.com/ml/introduction-to-ensemble-learning-methods-in-ml.html</guid>
        <!--
        
        
        -->
      </item>
    
      <item>
        <title>Building a Data Science Portfolio</title>
        <description>&lt;p&gt;Having a good portfolio is very important to an individual’s success. It brings opportunities, helps get in touch with great people. Networking/new connections can bring in lot of mutual learning. People with like mindset, those who have worked on similar problems will get in touch. It’s a win-win for everyone.&lt;/p&gt;

&lt;p&gt;I would recommend doing lots-n-lots of hands on projects. If it’s beginner level, having different kinds of projects/datasets/problems helps in maximizing learning. If it’s in the intermediate/expert level or about specialization, doing a lot of different kind of projects related to the specialization under consideration helps strengthen skills.&lt;/p&gt;

&lt;p&gt;Secondly, as you work and gain expertise, you will build your own arsenal of code snippets that you might see yourself reusing often. Consider spinning them out into tools/libraries to give back to the community.&lt;/p&gt;

&lt;p&gt;Once you feel comfortable, start competing in hackathons. There are several opportunities online for all levels of expertise. One of the most notable is Kaggle.com. Start working on the challenges over there.&lt;/p&gt;

&lt;p&gt;GitHub is no doubt a nerds portfolio! Consider pushing most of your work to GitHub. If you don’t want to push your work to GitHub public repo, consider writing about that in your blog.&lt;/p&gt;

&lt;p&gt;Some tips for good presentation of repositories (portfolio)…&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;Each project should have a different repository (needless to say, but I’ve seen people stuffing code into same repo with a blanket name)&lt;/li&gt;
  &lt;li&gt;A neat and short ‘read me’ for each repository explaining a problem statement and the solution in short, preferably a single page at max.&lt;/li&gt;
  &lt;li&gt;Apart from code and introductory read me, document the solution approach in detail. The purpose of this is to show how the solution was built. It should include…
    &lt;ul&gt;
      &lt;li&gt;Problem statement&lt;/li&gt;
      &lt;li&gt;Info about dataset&lt;/li&gt;
      &lt;li&gt;Visualizations of data&lt;/li&gt;
      &lt;li&gt;train, cross validation, test and predict performance charts&lt;/li&gt;
      &lt;li&gt;accuracy, metrics and results&lt;/li&gt;
      &lt;li&gt;closing notes - challenges faced, possible enhancements, etc.&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;If code uses a jupyter notebook, code and the solution approach detail can be neatly presented together.&lt;/li&gt;
  &lt;li&gt;Last but not the least, keep sharing your knowledge through a blog (as I’m doing!)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All the best!&lt;/p&gt;
</description>
        <pubDate>Fri, 26 May 2017 00:00:00 +0000</pubDate>
        <link>http://abhijitannaldas.com/ml/building-a-data-science-portfolio.html</link>
        <guid isPermaLink="true">http://abhijitannaldas.com/ml/building-a-data-science-portfolio.html</guid>
        <!--
        
        
        -->
      </item>
    
      <item>
        <title>My first Machine Learning Hackathon</title>
        <description>&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;h4 id=&quot;tldr&quot;&gt;&lt;em&gt;tl;dr&lt;/em&gt;&lt;/h4&gt;
&lt;blockquote&gt;
  &lt;p&gt;Sharing my Machine Learning hackathon participation experience. Hackathons are the best way to practice and get hands on experience. They bring out the best in us everytime, no exceptions. Look for hackathons that work for you, it’s better to work along the people rather than solving in silos (for learning at least)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Hackathons magically raise the enthusiasm and excitement of solving a problem. It takes the game altogether to a different level. Last week I solved my first machine learning problem for an online hackathon. I think hackathons bring the best out of us.&lt;/p&gt;

&lt;p&gt;HackerEarth hosted a &lt;a href=&quot;https://www.hackerearth.com/problem/machine-learning/bank-fears-loanliness/&quot; target=&quot;_blank&quot;&gt;Machine Learning Challenge&lt;/a&gt; where the challenge was to predict the probability of a loan being defaulted based on a dataset of over 5L records with 45 attributes/columns.&lt;/p&gt;

&lt;p&gt;Though I do solve some machine learning problems now and then, I was still mostly in a learning mode. But not anymore, this was the first decent and moderately difficult problem I solved. The learnings have been immense. I solved the challenge in Python achieving 97.6% accuracy. It’s posted on &lt;a href=&quot;https://github.com/avannaldas/Loan-Defaulter-Prediction-Machine-Learning&quot; target=&quot;_blank&quot;&gt;GitHub&lt;/a&gt;. I got a sense of what it takes to improve the accuracy point by point pushing the limits and getting the most insights out of data. And it all happens in hackathons when there is a leaderboard to compare the numbers, no matter where you stand on the leaderboard. It’s encouraging to see the accuracy figures in comparision ranked with other solutions as compared to solving the problem in silos. One might get content with 95% accuracy, but when we see it’s possible to do more with the same dataset, we push the limits of what we think we can do. Througout the 10 day Hackathon I gravitated on the leaderboard starting with 8th in the beginning rose to 4th at one point of time and then finally finished at 19th.&lt;/p&gt;

</description>
        <pubDate>Tue, 28 Mar 2017 00:00:00 +0000</pubDate>
        <link>http://abhijitannaldas.com/ml/my-first-machine-learning-hackathon.html</link>
        <guid isPermaLink="true">http://abhijitannaldas.com/ml/my-first-machine-learning-hackathon.html</guid>
        <!--
        
        
        -->
      </item>
    
      <item>
        <title>Mathematical Thinking</title>
        <description>&lt;p&gt;Mathematics is a fascinating subject. That was not true for me just two days ago. I started learning mathematics two days ago. Not because I loved it, but because I realized it’s a very important subject. I need to have very strong fundamentals about Mathematics if I wanted to learn Machine Learning, which I picked up 4 days ago! Isn’t that interesting, yes you need to pivot and change course to learn whatever it takes. I prefer understanding the basics.&lt;/p&gt;

&lt;p&gt;So when I started learning Mathematics 2 days ago, I realized and learnt a few things from the Math gurus who share their knowledge with the world through internet (some useful links at the end of page). I started loving Mathematics and now learning it in a way I have never imagined. The way mathematics is learned is the reason people hate it. Mathematics is abstract in nature, is a wrong belief people hold in general. On the flip side it is true that the way people learn/have been taught is abstract in nature.&lt;/p&gt;

&lt;p&gt;Learning mathematics can be very fun. Mathematics is all around us. Here are a few more important dis-beliefs about Mathematics:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Some people have inherent capabilities to do well in math, a math person&lt;/li&gt;
  &lt;li&gt;Mathematics can never be related to real life and learned with analogies&lt;/li&gt;
  &lt;li&gt;Mathematics is just abstract&lt;/li&gt;
  &lt;li&gt;We need to memorize all the formulae&lt;/li&gt;
  &lt;li&gt;We need to memorize all the rules&lt;/li&gt;
  &lt;li&gt;Mathematics is all about numbers, rules, methods&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;There are tons of such dis-beliefs about mathematics which makes people treat mathematics differently and keep it at bay. To learn mathematics its important to note a few points:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Anyone can learn mathematics and start loving it, provided the learning approach is changed&lt;/li&gt;
  &lt;li&gt;Mathematics is a study of patterns (as Mathematician Keith Devlin says)&lt;/li&gt;
  &lt;li&gt;It’s very important to understand and internalize the concepts rather than memorizing the formulae, procedures and methods of solving something&lt;/li&gt;
  &lt;li&gt;Solving a mathematical problem is not always fast, it takes time. And that’s where most of the people give up.&lt;/li&gt;
  &lt;li&gt;Imagine reading an article (could be about anything) and not understanding it even after trying very hard for a reasonable time. Difficult to imagine, right? We generally understand what we read very quickly. Usually within few minutes in rare cases where we cannot comprehend the text easily or the concept is a bit tough, it would typically take a little longer. But we would understand it. This is not the case with Mathematics, it usually takes longer. And that’s where the mathematical understanding deepens, when we persevere.&lt;/li&gt;
  &lt;li&gt;It’s important to keep in mind that it’s perfectly fine to struggle at a problem. Struggling is where the search for different pathways and patterns begins. This struggle also helps deepen the understanding of concept and improve the relationship with numbers!&lt;/li&gt;
  &lt;li&gt;If you have ever solved a mathematical problem in a totally different way, even if it was accidentally that you realized oh, it can be solved this way. You can imagine the satisfaction and happiness it gives to find a pattern/pathway to solution that wasn’t taught in class or described in the textbook you were referring to. This is how the learning should be, naturally and intuitively. And there would never be another boring math problem!&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Below are some quick references where you can start learning mathematics and change your perception about it:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=3icoSeGqQtY&quot;&gt;How you can be good at math, and other surprising facts about learning - Jo Boaler - TEDxStanford&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=ytVneQUA5-c&quot;&gt;Five Principles of Extraordinary Math Teaching - Dan Finkel - TEDxRainier&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.coursera.org/learn/mathematical-thinking&quot;&gt;Introduction to Mathematical Thinking – Coursera.org&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.ted.com/topics/math&quot;&gt;Ted Talks about Mathematics&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
</description>
        <pubDate>Wed, 10 Aug 2016 00:00:00 +0000</pubDate>
        <link>http://abhijitannaldas.com/ml/mathematical-thinking.html</link>
        <guid isPermaLink="true">http://abhijitannaldas.com/ml/mathematical-thinking.html</guid>
        <!--
        
        
        -->
      </item>
    
      <item>
        <title>Mathematics for Machine Learning</title>
        <description>&lt;p&gt;I’ve just started learning Machine Learning. I stumbled upon mathematical expressions that I’ve never seen before! And that’s where I took a break on that and turned to first learn the required Mathematics before I get into Machine Learning.&lt;/p&gt;

&lt;p&gt;Good fundamentals with the maths subjects like Calculus, Linear Algebra help immensely help learn Machine Learning. As I started looking for what all I need to learn, questions like where to start? what to learn? in what sequence? started popping up. It took me a few days to figure out what all Mathematics needs to be studied for Machine Learning.&lt;/p&gt;

&lt;p&gt;Well, we are lucky we have numerous structured online learning resources, open-sourced learning content today. In case you’d like to understand the math behind the machine learning. You can get quickly started with Linear Algebra and Calculus basics. Links at the end of page. First two links would be sufficient to get started.&lt;/p&gt;

&lt;p&gt;Since it took me a few days to understand all about this when I started looking into Machine Learning, I hope this helps you have a good head start.&lt;/p&gt;

&lt;p&gt;Useful links…&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.khanacademy.org/math/linear-algebra&quot; target=&quot;_blank&quot;&gt;Linear Algebra - Khan Academy&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.coursera.org/learn/calculus1&quot; target=&quot;_blank&quot;&gt;Calculus One - Coursera.org&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://lagunita.stanford.edu/courses/Education/EDUC115-S/Spring2014/about&quot; target=&quot;_blank&quot;&gt;How to learn math - Stanford&lt;/a&gt; - A short course which introduces to a different approach of learning math&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://fastml.com/math-for-machine-learning/&quot; target=&quot;_blank&quot;&gt;Math for machine learning&lt;/a&gt; - An interesting blog post&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/ml/useful-stuff/&quot;&gt;Useful Stuff&lt;/a&gt; - Page of this blog&lt;/li&gt;
&lt;/ul&gt;
</description>
        <pubDate>Mon, 08 Aug 2016 00:00:00 +0000</pubDate>
        <link>http://abhijitannaldas.com/ml/mathematics-for-machine-learning.html</link>
        <guid isPermaLink="true">http://abhijitannaldas.com/ml/mathematics-for-machine-learning.html</guid>
        <!--
        
        
        -->
      </item>
    
  </channel>
</rss>
