A simple explanation and implementation of DTs ID3 algorithm in Python

Photo by Vladislav Babienko on Unsplash

Decision trees are one of the simplest non-linear supervised algorithms in the machine learning world. As the name suggests they are used for making decisions in ML terms we call it classification (although they can be used for regression as well).

The decision trees have a unidirectional tree structure i.e. at every node the algorithm makes a decision to split into child nodes based on certain stopping criteria. Most commonly DTs use entropy, information gain, Gini index, etc.

There are a few known algorithms in DTs such as ID3, C4.5, CART, C5.0, CHAID, QUEST, CRUISE. …

and a bonus stock to top it up

Photo by Nick Chong on Unsplash

As the topic suggests we are looking at stocks that have come down substantially from their recent peaks. We won’t be discussing the “Hot stocks” as what is being served when you switch ON your television.

I have picked the stocks based on the following parameters:

  • strong fundamentals: companies with stable or increasing earnings. Even good dividend stocks have been included.
  • real products: Real companies are the ones which we can see, feel, or experience. Their products or services we use often.
  • reasonable valuation: Price to Earnings or Price to Book value…

AutoML implementation of text classification in Python

Photo by Alex Knight on Unsplash

The journey to predict the future or automate mundane stuff or understand a large amount of data for building strategies has come a long way from statistical techniques to machine learning algorithms to neural nets and deep learning. The potential of these techniques and the corresponding results have motivated new use cases and served humanity to date.

Data Scientists, statisticians, and researchers have developed many techniques and architectures to serve specific purposes, and the architectures have been utilized in numerous other fields (a concept known as Transfer Learning). These hand-designed architectures used for…

I was about to write this article on 16th Feb but somehow got distracted. Seems like Nifty is heading in the direction I was predicting it to be. On Feb 16 it was not really weak but it weakened after that.

The screenshot has been taken from the Kite tool powered by Zerodha

In the chart above I have highlighted the 2 support lines of Nifty represented by bold white. Nifty has been taking support on the first one from March to August before breaking it at August expiry. Now this line has been acting as a resistance. Thus a new support line has been seen to support it from September 2020…

Dow Jones Industrial Average Index (DJI) has jumped nearly 1000 points last week. Let’s go through the technical analysis to see if the up-move will continue.


DJI opened gap-down on Feb 9 but quickly chased up to fill the gap crossing above 31400 around 1 PM and then traded in a narrow zone of 31400–31440, falling below 31400 at closing.

Source: Google

Technical Analysis

As shown in the candlestick chart below, the market has been taking support at the blue trend line since 3rd Feb. Today’s first bearish candle has broken that support, and the same trendline is now acting as a resistance.

Implementation in python with charts

Photo by Jack Anstey on Unsplash

You must be thinking this is yet another somebody talking about technical indicators. Nope! this is just a start. We are going to learn what “Bollinger Bands” are and when we use them. And we would also understand in upcoming articles, how ML can make use of these indicators for “Buy” and “Sell” decisions.

So, are you ready to develop your own Algo Trading software?

Of course, that sounds interesting. But before that, let’s delve into some theory.

Bollinger Bands

Bollinger Bands are a technical analysis tool (a type of price envelope — define upper and lower…

Simple techniques to exploit your brain potential and avoid procrastination.

Baby vector created by user2104819 — www.freepik.com

Training your brain can sometimes be as easier as training a baby dragon. Try once if you find one! The brain requires different challenges as our body does to grow stronger and sharper. Just as you train your legs, arms, and chest, the brain also needs the exercise of its components. Take, for example, your intelligence and memory come from different parts of the brain. Its learning abilities include both the memorizing ability and problem-solving ability.

How do you work out your brain?

Whether you are reading through your coursebook for a test tomorrow or you are…

A simple guide to volatility based stock selection from Nifty50 with python implementation

Photo by M. B. M. on Unsplash

Lockdown due to COVID-19 although was frustrating but opened up avenues to practice something new. My new was trading. Looking at top gainers and losers after market hours and analysing charts to compute maximum possible earnings I could have, fascinated me.

I learnt technical analysis, made a lot of mistakes one of which was trading when market is sideways or in less volatile stocks. When stock prices don’t fluctuate we can’t make money (buy on low, sell or high).

For a day trader, trading is a four…

An application of Bayes Theorem, and Total Probability Law in one of the classic probability problems

Photo by vahid kanani on Unsplash

To start with let’s revisit Bayes Theorem, which describes the probability of an event, based on prior information of events related to the event.


Ankit Malik

Indian Blogger, Data Scientist at Workfusion, and Technical Reviewer for Packt Publishing. Loves numbers, equity markets, and insights through data.

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