Skip to main content

This is the homepage and blog of Dhruv Thakur, a Data Scientist in the making. Here's what I'm up to currently. For more about me, see here.


ML Basics #4: Replace Negatives With Zeros!

This is the fourth post in this series on the basics of Machine Learning. These posts are intended to serve as companion pieces to this zine on binary classification. In the last one, we learnt how adding hidden layers to a Multilayer Perceptron helps it learn increasingly complex decision boundaries. The MLPs used till now made use of the sigmoid function as the activation function. In this post, we'll move our focus to a much simpler kind of activation function: The Rectifier.

The rectifier was first demonstrated as a better activation function for training deep neural networks — as compared to sigmoid or hyperbolic tangent — by Xavier Glorot, Antoine Bordes, and Yoshua Bengio.

A unit employing the rectifier is called a rectified linear unit (ReLU).

Read more…

ML Basics #3: More Layers!

This is the third post in this series on the basics of Machine Learning. These posts are intended to serve as companion pieces to this zine on binary classification. In the last one, we learnt how a Multilayer Perceptron can be trained to non-linearly segment a dataset. We also saw how a simple artificial neuron forms the building block of a Multilayer Perceptron — or a neural network in general — which can learn much more complicated decision boundaries.

Let's move on to datasets that are harder to segment. One way to improve the learning capability of a MLP is to add more neurons in the form of hidden layers. In this post we'll explore MLPs with 2 hidden layers.

Read more…

ML Basics #2: Multilayer Perceptron

This is the second post in this series on the basics of Machine Learning. These posts are intended to serve as companion pieces to this zine on binary classification. The last post detailed the functioning of an artificial neuron, and how it can be trained to linearly segment a dataset. However, most real world datasets are not linearly separable, which begs the question:

What is the point of learning about a neuron?

Well, by the end of this post, we'll see that a bunch of neurons, when stacked together, can learn to create powerful non-linear solution spaces. Let's see how that works.

Read more…

The Autodidact's Register: Issue #1

The World Wide Web houses the greatest library ever known to man. This metaphorical libary is chock full of all kinds of resources one needs to acquire skills and knowledge. Naval Ravikant puts it succintly ⁠⁠⁠— "The internet is the best school ever created. The best peers are on the Internet. The best books are on the Internet. The best teachers are on the Internet. The tools for learning are abundant. It’s the desire to learn that’s scarce."

However, the sheer volume of information available on the web makes cataloguing resources a challenging task. After bookmarking hundreds of articles, podcast episodes, tweets, videos etc., I've realized that I rarely visit these resources for a second ⁠⁠⁠⁠time ⁠⁠⁠— which is something I know I should be doing. Hell, even bookmarking amazing tweets doesn't seem to be of any fruitful purpose, as they eventually get buried in the list of favorites. Same goes for great blog posts, articles and other kinds of media. Hence, I've decided to create digests of resources from which I learn from, both for my own reference, and for others who might find this information useful. I'm calling this series of digests "The Autodidact's Register". This is the first issue.

Read more…

ML Basics #1: Start With A Neuron

This is the first post in this series on the basics of Machine Learning. These posts are intended to serve as companion pieces to this zine on binary classification. The zine mainly focusses on the mathematical foundations of binary classification, while these posts include implementation and analysis of the concepts as well. My aim here is to create a comprehensive catalogue of ML concepts so that I can quickly refer to them in the future, as well as be of help to anybody in a position similar to mine.

This post complements the first segment in the zine: Linear Binary Classification. The idea is to have the content here supplement that in the zine.

The other posts in series can be found here.

Read more…

Takeaways from Naval Ravikant's JRE episode

Naval Ravikant recently made an appearance on The Joe Rogan Experience. An entrepreneur and an angel investor — he’s invested in more than 100 companies, including Uber, Twitter, Yammer, and many others — Naval is a co-author of Venture Hacks, and a co-maintainer of AngelList. In their two-hour long conversation, he and Joe discuss a wide array of topics — namely philosophy, knowledge gathering, meditation, happiness and satisfaction, wealth creation, social media, socialism v. capitalism, industrial automation and the future of AI, etc. — making this information dense episode worthy of repeat listens. While the episode is flush with profound ideas, I’ve jotted down the ones that I found germane for myself.

image credit.


A key insight from this conversation is the notion of building a unique skill set. Naval talks about a paucity of individuals who combine ideas which are rarely bundled together. According to him, people who’ve carved out a niche for themselves are the ones who’ve learnt to mold their hobbyhorses into remunerative enterprises . To elucidate this point, he gives the example of Joe, who has multifarious talents — he’s is a successful comedian, a UFC commentator, and the host of one of the most popular podcasts today. Naval postulates that in the event of the JRE getting cancelled for some reason, the podcast next in popularity cannot take its place because it cannot occupy Joe’s unique place in the milieu of podcasting. The amalgamation of skills from distinct walks of life — all of which stem from his hobbies — give him a unique perspective which is very hard to emulate.

Read more…

Using Service Accounts for GKE workloads

As per GCP's documentation "A service account is a special type of Google account that belongs to your application or a virtual machine (VM), instead of to an individual end user. Your application assumes the identity of the service account to call Google APIs, so that the users aren't directly involved."

Service accounts are used to authenticate users of a specific application, whilst maintaining proper access control to cloud resources. They come in handy when you have multiple applications running on GCP, each requiring a distinct set of privileges to function. The idea is to grant the service account only the minimum set of permissions required to achieve their goal. I'll list the basic steps required to get up and running with a Python app running on GKE using a SA.

Read more…

Book Summary: Atomic Habits

Quick summary

Combination of small habits can yield remarkable results. Good habits thrive in a system designed to let them flourish without friction. Knowledge of the science and psychology behind habit formation can enable people to function at peak potential.


Atomic Habits details a comprehensive analysis on how to build habits and live better. In James Clear’s (the author) words, “Atomic Habits offers a proven framework for getting 1 percent better every day”.

Read more…

Understanding the A star algorithm

I recently learnt about the workings of the A* algorithm through Udacity's Intro to Self Driving Cars Nanodegree, and wanted to understand it in detail, hence this post on it.

Wikipedia article on A* states: "A star is a computer algorithm that is widely used in pathfinding and graph traversal, which is the process of finding a path between multiple points, called "nodes". It enjoys widespread use due to its performance and accuracy."

It was devised by Peter Hart, Nils Nilsson and Bertram Raphael of Stanford Research Institute (now SRI International) who first published the algorithm in 1968.

Read more…

Summary Notes: Bayes' Theorem

I just started Udacity's Intro to Self Driving Cars Nanodegree and the very first thing the instructors teach in it is Bayes' theorem. I read about it in school, but now's the time for me to really get into it, hence this summary note.

Bayes' theorem gives a mathematical way to correct predictions about probability of an event, and move from prior belief to something more and more probable.

The intuition behind application of Bayes' theorem in probabilistic inference can be put as follows:

Given an initial prediction, if we gather additional related data, data that the initial prediction depends upon, we can improve that prediction.

Read more…