Image for post
Image for post
Photo by Macau Photo Agency on Unsplash

Learn how queues are used in real applications and it’s implementation in Python and C++

Queue is one of the simplest and most useful data structure, not just in computer science, queues are relevant in our day to day life in lot of different fields.

In this post, we will discuss why queues are so important, how they are used in computer science and finally look at its implementation in Python and C++. The goal is to understand the queue pattern, and understand why they exist, this will hopefully help you appreciate queues and want to learn it.

Watch the video version if you prefer that !

Practical Applications

So what makes queues special ? A queue is a data structure that follows First In First Out — which means the first item to enter the queue is the first to leave the queue. …

You wouldn’t be able to read this now if stacks didn’t exist. Stacks described from a practical perspective for engineers.

Stack is one of the most popular and widely known data structures in computer science, and one of the easiest to learn and understand. But often, maybe because of the way it is introduced or taught, it seems kind of useless and boring to learn.

Stacks are not one of those useless things that you need to learn just to pass your exams or to crack the coding interview, but they are actually used for a lot of things that you do daily on the computer.

Watch the video version if you prefer that :)

Practical Applications

  • They are the building blocks of function calls and recursive functions. Yes, this is a common application that you maybe aware of, but think about it — right now there are hundreds (if not thousands) of functions existing on your call stack in memory maintained by your OS. Every time a function is called, some memory is reserved (PUSH) for it on the call stack, and when it returns, the memory is deallocated (POP). …

A practical guide for beginners to understand and implement a neural network.

Neural Networks have taken over the world and are being used everywhere you can think of. There are a lot of posts out there that describe how neural networks work and how you can implement one from scratch, but I feel like a majority are more math-oriented and complex, with less importance given to implementation. My main focus today will be on implementing a network from scratch and in the process, understand the inner workings.

The goal of this post is to walk you through on translating the math equations involved in a neural network to python code. …

The exponential impact a single person can have on flattening the curve visualised using pandas and matplotlib in python.

Image for post
Image for post
Flattening The Curve

COVID-19 has taken over the world and brought the entire world to a stand still in just a few months. Total cases in the world will be half a million soon and over 20,000 deaths have been confirmed. The worrying part is the graph of total cases is still exponentially increasing, and showing no signs of slowing down.

Flattening the curve by social distancing seems to be the only way out of this. Many countries have been locked down in the past few weeks, and people have been asked to strictly stay at home. …

Learn how logistic regression works and how you can easily implement it from scratch using python as well as using sklearn.

In statistics logistic regression is used to model the probability of a certain class or event. I will be focusing more on the basics and implementation of the model, and not go too deep into the math part in this post.

Image for post
Image for post
The value of weights b0 and b1 are updated at each iteration

This is a written version of this video. Watch the video if you prefer that.

Logistic regression is similar to linear regression because both of these involve estimating the values of parameters used in the prediction equation based on the given training data. Linear regression predicts the value of some continuous, dependent variable. Whereas logistic regression predicts the probability of an event or class that is dependent on other factors. Thus the output of logistic regression always lies between 0 and 1. …

In this quick post I wanted to share a very popular and easy way of detecting faces using Haar cascades in OpenCV and Python.

The video version for those who prefer that !

First of all make sure you have OpenCV installed. You can install it using pip:

pip install opencv-python

Face detection using Haar cascades is a machine learning based approach where a cascade function is trained with a set of input data. OpenCV already contains many pre-trained classifiers for face, eyes, smiles, etc.. Today we will be using the face classifier. You can experiment with other classifiers as well.

You need to download the trained classifier XML file (haarcascade_frontalface_default.xml), which is available in OpenCv’s GitHub repository. Save it to your working location.

To detect faces in…

A list of lessons to always remember and make the most out of life.

I just turned 20 last month. So here are 20 lessons that I have learned from life over all these years.

Image for post
Image for post
Photo by Axel Antas-Bergkvist on Unsplash

1. There are no shortcuts

Hard work eventually pays off and there are no shortcuts or substitutes to replace it. If you want to master any skill then you have to put in the work. All you can do is improve efficiency by doing focused and smart work.

2. Health is wealth

Health is a huge factor for success in any field. By health I mean physical as well as mental health. You need to have the physical energy to work as well as a healthy mind to focus your attention and deal with stress. …

Every time we read an article about how to be more productive, we feel motivated for the next week, or maybe few days or even the next few hours. Then the drive slowly wears out and we are back to our old ways again.

Image for post
Image for post
“man holding smartphone looking at productivity wall decor” by Andreas Klassen on Unsplash

I think that rather than trying to be productive, our goal should be to be more consistent. Making progress every day, taking small steps and being patient. So I thought of putting together 4 productivity ideas that I use and have worked for me.

1. Why ?

Always start with why. Why do you work? Why is it that you do what you do? Once you have a clear sense of why, you are half way there. Your why is your motivating force. It should be something that makes you jump out of bed every morning and drives you throughout the day. …

In this quick post, I wanted to share a method with which you can perform linear as well as multiple linear regression, in literally 6 lines of Python code.

Check out the video version of this post if you prefer that !

In statistics, linear regression is a linear approach to modelling the relationship between a dependent variable and one or more independent variables. I you would like to know more about linear regression and how it is implemented, check out these two methods to perform Linear Regression from scratch:

Today to perform Linear Regression quickly, we will be using the library scikit-learn. If you don’t have it already you can install it using…

In this tutorial you can learn how the gradient descent algorithm works and implement it from scratch in python. First we look at what linear regression is, then we define the loss function. We learn how the gradient descent algorithm works and finally we will implement it on a given data set and make predictions.

Image for post
Image for post
The values of m and c are updated at each iteration to get the optimal solution

This is the written version of this video. Watch it if you prefer that!

Linear Regression

In statistics, linear regression is a linear approach to modelling the relationship between a dependent variable and one or more independent variables. Let X be the independent variable and Y be the dependent variable. …


Adarsh Menon

I make websites and teach machines to predict stuff. I also make YouTube videos —

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store