Predicting The IPL-2020 Winner Using Machine Learning

3+
In this article, we will do some EDA on the IPL dataset to find out some important factors in determining the winning team and also try to predict the outcome of IPL matches using some Supervised Machine Learning Algorithms.

                                                            Source: kalingatv.com

In this article, we will be going through some interesting statistical analysis and also try to predict the outcome of the IPL match results using machine learning algorithms. As we all know that cricket is a very popular game in India and is watched by millions of Indians and so after the start of IPL season the Indian cricket standard reached it’s highest levels where not only International cricketers participated to win the cup but also local Indian talent were introduced through this platform. So in this article, I will be doing some analysis where I will also try to predict the outcome of the IPL matches using Python and some Machine learning Algorithms. So let’s begin with this journey.

Step 1: Loading the necessary Libraries:

So these are some basic libraries that we need. We’ll also use some external libraries as we move on.

Step 2: Importing the dataset:

So this is what our dataset comprises of:-

We can also use the describe method to see numerical insights into our data.

This method is conveniently to decide if you want to find out insights into your data and it also helps us to understand data in more detail.

Step 3:- Data Visualization

Now let’s do some interesting visualization where we’ll find out the winning probability of the teams over the years, with the help of a barplot. The code for it is as follows:-

This is what the output look’s like:-

Now let’s do an interesting analysis with the help of a Pie chart where we extract records where a team won after batting first. Here is the code for it:-

         Winning Team After they decide to bat first

As we can see we have a total of eight teams and out of those Mumbai, Chennai, Hyderabad & Punjab are the top 4 teams which have high winning statistics when they decided to bat first.

Now let’s do another analysis where we’ll now extract those records where a team won after batting second. Here is the code for it:-

Winning Team After they decide algorithms to bat second

Here we can see that Mumbai, Chennai, Chennai & Delhi are the top 4 teams which have high winning statistics when they decided to bat second.

Let’s also do an interesting analysis where we find out which player has made the most runs in IPL. Here is the code:-

Here’s what the output look’s like:-

As we can see Virat Kohli is one of the top batsmen in IPL from RCB as he has scored most runs over the years, no wonder why he’s called the “King of the Decade”.

Source: insidesport.co

So now as we’ll conclude the analysis and move on to our final step that is we’ll apply some machine learning algorithms to predict the outcome of the matches. So let’s start.

Step 4:- Machine Learning Model Selection

So we’ll take our data and divide split it into training and testing, and as it is a multiclass classification problem we will use logistic Regression for this problem. You can try other classification algorithms too, and if you want to learn more about classification algorithms, make sure to go through this link:- Link.  So the code is as follows:- 

After applying the model to our testing dataset we can now successfully predict the outcome of all the final matches. Our final output is as follows:-

We successfully predicted the winning teams for the following matches. Now you can sit back, relax and see if your favorite team is going to win or not in this IPL season

Thanks a lot for reading this article.

close
3+

You may also like...

1 Response

  1. November 12, 2020

    […] by /u/utkarsh17591 [link] […]

    0

Leave a Reply

Your email address will not be published. Required fields are marked *

DMCA.com Protection Status