# GooglyPlusPlus2021 bubbles up top T20 players in all formats!

**R – Giga thoughts …**, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

*“Would you tell me, please, which way I ought to go from here?”**“That depends a good deal on where you want to get to.”**“I don’t much care where –”**“Then it doesn’t matter which way you go.”*

**Lewis Carroll, **Alice in Wonderland

This latest version of GooglyPlusPlus2021 has the following updates

– brand new strategy and algorithm for ranking T20 players in any format (IPL, BBL, NTB, PSL etc.)

– integrates the Caribbean Premier League T20 into the app

– includes the latest BBL matches in 2020-2021

– includes all the latest Natwest T20 matches 2020

– has a new and better user interface

Interestingly the new Ranking algorithm has come just before the IPL auction. Check out who’s who in IPL T20 by taking GooglyPlusPlus2021 for ride!!!

Try out GooglyPlusPlus2021!!

You can clone/fork the code from Github at GooglyPlusPlus2021

**1) Ranking Algorithm**

In my last post GooglyPlusPlus2021 interactively ranks T20 batsmen and bowlers!!! I had shown how by changing the number of matches played we see that KL Rahul and Rishabh Pant move above Virat Kohli. That set me thinking. So, I redesigned the ranking so that we start to identify newer players earlier. This is how the new ranking works.

**a) Ranking T20 batsmen** :

I have the following controls

a) **Since year** : This tells the year range to consider for the batsmen. This slider moves from right to left

b) **Matches played** : Number of matches played by the batsman in the year range. This moves left to right

c) **Mode** : The ranking algorithm sorts on and ranks on 2 columns namely Runs and Strike rate. The mode tells whether to consider Runs over Strike rate of Strike rate over runs.

By default, the control for “Since year” will be set to the ‘beginning of time’ which for IPL data is 2008. If you move the ‘Since year’ since year slider to the left, the ‘Matches played’ slider will move to the right and the corresponding maximum value of matches played will be set appropriately.

**b) Ranking T20 Bowlers:**

This has the following controls

a) **Since year** : This tells the year range to consider for bowler in IPL. Moves right to left.

b) **Matches played** : Number of matches played by the bowler in the year range. Move left to right.

c) **Mode** **1:** The bowlers are sorted and ranked on 2 columns namely Wickets and Economy rate. The mode tells whether to consider Wickets over Economy rate or Economy rate over wickets when ranking the bowlers.

By default, the “Since year” will be set to the year when the T20 data is available. If you move the ‘Since year’ since year slider to the left, the ‘Matches played’ slider will move to the right and the corresponding maximum value of matches played will be set appropriately.

**2) Strategy for ranking**:

Here is the rationale and philosophy behind these controls

The ranking in my earlier post GooglyPlusPlus2021 interactively ranks T20 batsmen and bowlers!!! is based on sorting batsmen and bowlers from the start of IPL tournament. Hence we will find players who have played a lot of matches. So in the bowler ranking you will SL Malinga who no longer plays IPL.

Hence I decided that the user should be allowed to choose the start year to consider for the ranking. We can move the “Since year’ slider from right to left to choose the data for the year range we are interested in e.g. (2014-2020, or 2017-2020). Changing the ‘Since year’ slider will obviously change the maximum matches played by any player. However the user can move this slider right to left and decide the number of matches to be considered for a batsman or bowler. Finally, the ‘Mode’. will allow the user to choose whether the list if batsmen should be ranked first by average runs and then average strike rate or vice versa. In the case of bowlers, the choice is whether to first sort by number of wickets and then economy rate or vice versa.

The consideration for ‘Mode’ and “Mode1′ is that while runs and wickets are important for batsman or bowler, it is clear the Strike rate and Economy rate become critical in ‘**death overs**‘. Batsmen who can accelerate the scoring rate when needed and bowlers who can put the brakes on during death overs is of paramount importance in T20 cricket.

Let me walk through a few scenarios in IPL T20. The same functionality is also available in alll other T20 formats (Intl. T20 (men, women), BBL, NTB, PSL, WBB, CPL etc.)

### 3) Ranking IPL batsmen

**Note**: Those players who are underlined in red are the **shooting stars****

**a) Scenario 1**

These are the consistent and reliable players

Since year = 2013, Matches played = 95 and Mode = ‘Runs over Strike Rate’

**b) Scenario 2**

Since year = 2015, Matches played = 67 and Mode = ‘Runs over Strike Rate’

**c) Scenario 3**

We can turn the above over its head and choose Mode = “Strike rate over Runs’

Since year = 2015, Matches played = 67 and Mode = ‘Strike Rate over Runs’

**d) Scenario 4: **

Since year = 2018, Matches played = 35 and Mode = ‘Runs over Strike Rate’

### 4) Ranking IPL bowlers

e) **Scenario 5:**

Since year = 2016, Matches played = 55 and Mode1 = ‘ Wickets over Economy Rate’

f) **Scenario 6**

Since year = 2018, Matches played = 33 and Mode1 = ‘ Economy Rate over wickets’. **Note** the economy rate is sorted in ascending order

**Note**: Incidentally the ranking of IPL and other T20 players in my earlier posts is a special case, when you consider all matches from the beginning of time (or since the data is available, rather than choosing a range from later years).

**Note 1**: Personally, if I had to form a team, I would choose

– at least 2-3 batsmen who are reliable and have good average runs and a good strike rate

– 2 batsmen who can be used to accelerate strike rate during critical junctures or at death overs

– 2-3 bowlers who have a great record of wicket taking with good economy rate (2 + 1 pace/spin)

– 2 bowlers who have good economy rate over wickets

– 2 all rounders with good batting and bowling average

– 1 wicketkeeper batsmen

The key point is how many matches would you consider as a minimum for reliability or strike rate. More is good but not always better as you could miss out on **rising stars*** who may be risky but good picks and possibly cost less, since the team composition will also depend on the available budget for each team. You could also check other T20 formats for good T20 players. Creating a T20 team in IPL is an optimization problem where the objective is to maximize the runs, strike rate for batsmen, or maximizing the wickets taken, while minimizing the economy rate for bowlers with the constraint of the overall budget of the team.

Note 2: The ranking algorithm has been included for all T20 formats in GooglyPlusPlus2020. See below

5) **International T20 Batsmen (men) ranking**

Since year = 2012, Matches played = 50 and Mode = ‘Runs over Strike Rate’

6) **International T20 Bowlers (men) ranking**

Since year = 2013, Matches played = 33 and Mode1 = ‘Wickets over Economy Rate ‘

Here are some top class T20 bowlers

7) **International T20 Batsmen (women) ranking**

Since year = 2015, Matches played = 29 and Mode = ‘Runs over Strike Rate’. Smriti Mandhana makes it to the top 3 in Runs over Strike Rate!

and 2nd when Strike rate over runs is considered!

### 8) Integrating Carribean Premier League T20

In this version I have also integrated Carribean Premier League (CPL). It took me about 3 -4 hours of focused work to setup the data and the associated code. Like every other T20 format, CPL league has access to 100+ functions of yorkr. So you can do analysis of CPL batsmen, bowlers, CPL matches, CPL head-to-head confrontation and CPL team against all other teams besides the ranking function. You can also generate batting and bowling scorecard for matches, for a team against all other teams and the overall scorecard in all matches against all other teams. Here is a random sample

a) C Munro – Cumulative Average Runs

b) RR Emrit – Bowler’s wickets against opposition

c) Head-to-head (Barbados Tridents vs Antigua Hawkbill all matches)

d) Rank CPL batsmen

Since year= 2016, Matches played = 41 Mode = Strike rate over Runs

Nicholas Pooran tops the list

### 9) BBL 2020-21

GooglyPlusPlus2021 now has the latest Big Bash League matches of 2020-21, in fact “**hot off the pitch**“. So you should be able to do all the analysis on current BBL data namely batsmen and bowler analysis, match analysis, team analysis vs another team or against all other teams, and finally ranking of batsmen and bowlers. Here is a sample with yesterday’s match

a) Match scorecard -Perth Scorchers- Sydney Sixers 06 Feb 2021 (Final)

b) Predict runs of batsman – CA Lynn

### 10) Natwest T20 Blast 2020

I noticed recently the Cricsheet has more data. Now NTB data includes all matches till 2020. This data has been incorporated into NTB and you should be able to use all the yorkr functions to analyze batsmen, bowlers, teams, team-vs-team and team vs all other teams, besides the ranking functions. Here are a couple below

a) Head-to-head Derbyshire vs Essex all matches

b) Team Batsmen vs Bowlers – All matches all opposition Leicestershire (MJ Cosgrove)

Do check out the various functions of GooglyPlusPlus2021. Take a look at the ranks of the T20 batsmen and bowlers. Hope you have a good time!

Take GooglyPlusPlus2021 for a test ride!!

Feel free to clone/fork the code from Github at GooglyPlusPlus2021

Also see

- Cricketr adds team analytics to its repertoire!!!
- Introducing cricket package yorkr: Part 2-Trapped leg before wicket
- Introducing cricpy:A python package to analyze performances of cricketers
- Big Data-5: kNiFi-ing through cricket data with yorkpy
- Using Linear Programming (LP) for optimizing bowling change or batting lineup in T20 cricket
- See all 72+ posts on cricket in R, Python and Octave
- Deep Learning from first principles in Python, R and Octave – Part 5
- Practical Machine Learning with R and Python – Part 3
- Understanding Neural Style Transfer with Tensorflow and Keras

To see all post click Index of posts

**leave a comment**for the author, please follow the link and comment on their blog:

**R – Giga thoughts …**.

R-bloggers.com offers

**daily e-mail updates**about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.