# GooglyPlusPlus: Win Probability using Deep Learning and player embeddings

In my last post ‘GooglyPlusPlus now with Win Probability Analysis for all T20 matches‘ I had discussed the performance of my ML models, created with and without player embeddings, in computing the Win Probability of T20 matches. With batsman & bowler embeddings I got much better performance than without the embeddings

• glmnet – Accuracy – 0.73
• Random Forest (RF) – Accuracy – 0.92

While the Random Forest gave excellent accuracy, it was bulky and also took an unusually long time to predict the Win Probability of a single T20 match. The above 2 ML models were built using R’s Tidymodels. glmnet was fast, but I wanted to see if I could create a ML model that was better, lighter and faster. I had initially tried to use Tensorflow, Keras in Python but then abandoned it, since I did not know how to port the Deep Learning model to R and use in my app GooglyPlusPlus.

But later, since I was stuck with a bulky Random Forest model, I decided to again explore options for saving the Keras Deep Learning model and loading it in R. I found out that saving the model as .h5, we can load it in R and use it for predictions. Hence, I rebuilt a Deep Learning model using Keras, Python with player embeddings and I got excellent performance. The DL model was light and had an accuracy 0.8639 with an ROC_AUC of 0.964 which was great!

GooglyPlusPlus uses data from Cricsheet and is based on my R package yorkr

Here are the steps

A. Build a Keras Deep Learning model

a. Import necessary packages

import pandas as pd
import numpy as np
from zipfile import ZipFile
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
from tensorflow.keras import regularizers
from pathlib import Path
import matplotlib.pyplot as plt


b, Upload the data of all 9 T20 leagues (BBL, CPL, IPL, T20 (men) , T20(women), NTB, CPL, SSM, WBB)

# Read all T20 leagues
print("Shape of dataframe=",df1.shape)

# Create training and test data set
train_dataset = df1.sample(frac=0.8,random_state=0)
test_dataset = df1.drop(train_dataset.index)
train_dataset1 = train_dataset[['batsmanIdx','bowlerIdx','ballNum','ballsRemaining','runs','runRate','numWickets','runsMomentum','perfIndex']]
test_dataset1 = test_dataset[['batsmanIdx','bowlerIdx','ballNum','ballsRemaining','runs','runRate','numWickets','runsMomentum','perfIndex']]
train_dataset1

# Set the target data
train_labels = train_dataset.pop('isWinner')
test_labels = test_dataset.pop('isWinner')
train_dataset1

a=train_dataset1.describe()
stats=a.transpose
a

c. Create a Deep Learning ML model using batsman & bowler embeddings

import pandas as pd
import numpy as np
from keras.layers import Input, Embedding, Flatten, Dense
from keras.models import Model
from keras.layers import Input, Embedding, Flatten, Dense, Reshape, Concatenate, Dropout
from keras.models import Model

# Set seed
tf.random.set_seed(432)

# create input layers for each of the predictors
batsmanIdx_input = Input(shape=(1,), name='batsmanIdx')
bowlerIdx_input = Input(shape=(1,), name='bowlerIdx')
ballNum_input = Input(shape=(1,), name='ballNum')
ballsRemaining_input = Input(shape=(1,), name='ballsRemaining')
runs_input = Input(shape=(1,), name='runs')
runRate_input = Input(shape=(1,), name='runRate')
numWickets_input = Input(shape=(1,), name='numWickets')
runsMomentum_input = Input(shape=(1,), name='runsMomentum')
perfIndex_input = Input(shape=(1,), name='perfIndex')

# Set the embedding size as the 4th root of unique batsmen, bowlers
no_of_unique_batman=len(df1["batsmanIdx"].unique())
no_of_unique_bowler=len(df1["bowlerIdx"].unique())
embedding_size_bat = no_of_unique_batman ** (1/4)
embedding_size_bwl = no_of_unique_bowler ** (1/4)

# create embedding layer for the categorical predictor
batsmanIdx_embedding = Embedding(input_dim=no_of_unique_batman+1, output_dim=16,input_length=1)(batsmanIdx_input)
batsmanIdx_flatten = Flatten()(batsmanIdx_embedding)
bowlerIdx_embedding = Embedding(input_dim=no_of_unique_bowler+1, output_dim=16,input_length=1)(bowlerIdx_input)
bowlerIdx_flatten = Flatten()(bowlerIdx_embedding)

# concatenate all the predictors
x = keras.layers.concatenate([batsmanIdx_flatten,bowlerIdx_flatten, ballNum_input, ballsRemaining_input, runs_input, runRate_input, numWickets_input, runsMomentum_input, perfIndex_input])

# Use dropouts for regularisation
x = Dense(64, activation='relu')(x)
x = Dropout(0.1)(x)
x = Dense(32, activation='relu')(x)
x = Dropout(0.1)(x)
x = Dense(16, activation='relu')(x)
x = Dropout(0.1)(x)
x = Dense(8, activation='relu')(x)
x = Dropout(0.1)(x)

output = Dense(1, activation='sigmoid', name='output')(x)
print(output.shape)

# create a DL model
model = Model(inputs=[batsmanIdx_input,bowlerIdx_input, ballNum_input, ballsRemaining_input, runs_input, runRate_input, numWickets_input, runsMomentum_input, perfIndex_input], outputs=output)
model.summary()

# compile model

model.compile(optimizer=optimizer, loss='binary_crossentropy', metrics=['accuracy'])

# train the model
history=model.fit([train_dataset1['batsmanIdx'],train_dataset1['bowlerIdx'],train_dataset1['ballNum'],train_dataset1['ballsRemaining'],train_dataset1['runs'],
train_dataset1['runRate'],train_dataset1['numWickets'],train_dataset1['runsMomentum'],train_dataset1['perfIndex']], train_labels, epochs=40, batch_size=1024,
validation_data = ([test_dataset1['batsmanIdx'],test_dataset1['bowlerIdx'],test_dataset1['ballNum'],test_dataset1['ballsRemaining'],test_dataset1['runs'],
test_dataset1['runRate'],test_dataset1['numWickets'],test_dataset1['runsMomentum'],test_dataset1['perfIndex']],test_labels), verbose=1)

plt.plot(history.history["loss"])
plt.plot(history.history["val_loss"])
plt.title("model loss")
plt.ylabel("loss")
plt.xlabel("epoch")
plt.legend(["train", "test"], loc="upper left")
plt.show()

Model: "model_5"
__________________________________________________________________________________________________
Layer (type)                   Output Shape         Param #     Connected to
==================================================================================================
batsmanIdx (InputLayer)        [(None, 1)]          0           []

bowlerIdx (InputLayer)         [(None, 1)]          0           []

embedding_10 (Embedding)       (None, 1, 16)        75888       ['batsmanIdx[0][0]']

embedding_11 (Embedding)       (None, 1, 16)        55808       ['bowlerIdx[0][0]']

flatten_10 (Flatten)           (None, 16)           0           ['embedding_10[0][0]']

flatten_11 (Flatten)           (None, 16)           0           ['embedding_11[0][0]']

ballNum (InputLayer)           [(None, 1)]          0           []

ballsRemaining (InputLayer)    [(None, 1)]          0           []

runs (InputLayer)              [(None, 1)]          0           []

runRate (InputLayer)           [(None, 1)]          0           []

numWickets (InputLayer)        [(None, 1)]          0           []

runsMomentum (InputLayer)      [(None, 1)]          0           []

perfIndex (InputLayer)         [(None, 1)]          0           []

concatenate_5 (Concatenate)    (None, 39)           0           ['flatten_10[0][0]',
'flatten_11[0][0]',
'ballNum[0][0]',
'ballsRemaining[0][0]',
'runs[0][0]',
'runRate[0][0]',
'numWickets[0][0]',
'runsMomentum[0][0]',
'perfIndex[0][0]']

dense_19 (Dense)               (None, 64)           2560        ['concatenate_5[0][0]']

dropout_19 (Dropout)           (None, 64)           0           ['dense_19[0][0]']

dense_20 (Dense)               (None, 32)           2080        ['dropout_19[0][0]']

dropout_20 (Dropout)           (None, 32)           0           ['dense_20[0][0]']

dense_21 (Dense)               (None, 16)           528         ['dropout_20[0][0]']

dropout_21 (Dropout)           (None, 16)           0           ['dense_21[0][0]']

dense_22 (Dense)               (None, 8)            136         ['dropout_21[0][0]']

dropout_22 (Dropout)           (None, 8)            0           ['dense_22[0][0]']

output (Dense)                 (None, 1)            9           ['dropout_22[0][0]']

==================================================================================================
Total params: 137,009
Trainable params: 137,009
Non-trainable params: 0
__________________________________________________________________________________________________
Epoch 1/40
937/937 [==============================] - 11s 10ms/step - loss: 0.5683 - accuracy: 0.6968 - val_loss: 0.4480 - val_accuracy: 0.7708
Epoch 2/40
937/937 [==============================] - 9s 10ms/step - loss: 0.4477 - accuracy: 0.7721 - val_loss: 0.4305 - val_accuracy: 0.7833
Epoch 3/40
937/937 [==============================] - 9s 10ms/step - loss: 0.4229 - accuracy: 0.7832 - val_loss: 0.3984 - val_accuracy: 0.7936
...
...
937/937 [==============================] - 10s 10ms/step - loss: 0.2909 - accuracy: 0.8627 - val_loss: 0.2943 - val_accuracy: 0.8613
Epoch 38/40
937/937 [==============================] - 10s 10ms/step - loss: 0.2892 - accuracy: 0.8633 - val_loss: 0.2933 - val_accuracy: 0.8621
Epoch 39/40
937/937 [==============================] - 10s 10ms/step - loss: 0.2889 - accuracy: 0.8638 - val_loss: 0.2941 - val_accuracy: 0.8620
Epoch 40/40
937/937 [==============================] - 10s 11ms/step - loss: 0.2886 - accuracy: 0.8639 - val_loss: 0.2929 - val_accuracy: 0.8621

d. Compute and plot the ROC-AUC for the above model

from sklearn.metrics import roc_curve

# Select a random sample set
tf.random.set_seed(59)
train = df1.sample(frac=0.9,random_state=0)
test = df1.drop(train_dataset.index)
test_dataset1 = test[['batsmanIdx','bowlerIdx','ballNum','ballsRemaining','runs','runRate','numWickets','runsMomentum','perfIndex']]
test_labels = test.pop('isWinner')

# Compute the predicted values
y_pred_keras = model.predict([test_dataset1['batsmanIdx'],test_dataset1['bowlerIdx'],test_dataset1['ballNum'],test_dataset1['ballsRemaining'],test_dataset1['runs'],
test_dataset1['runRate'],test_dataset1['numWickets'],test_dataset1['runsMomentum'],test_dataset1['perfIndex']]).ravel()

# Compute TPR & FPR
fpr_keras, tpr_keras, thresholds_keras = roc_curve(test_labels, y_pred_keras)

fpr_keras, tpr_keras, thresholds_keras = roc_curve(test_labels, y_pred_keras)
from sklearn.metrics import auc

# Plot the Area Under the Curve (AUC)
auc_keras = auc(fpr_keras, tpr_keras)
plt.figure(1)
plt.plot([0, 1], [0, 1], 'k--')
plt.plot(fpr_keras, tpr_keras, label='Keras (area = {:.3f})'.format(auc_keras))
plt.xlabel('False positive rate')
plt.ylabel('True positive rate')
plt.title('ROC curve')
plt.legend(loc='best')
plt.show()

The ROC_AUC for the Deep Learning Model is 0.946 as seen below

e. Save the Keras model for use in Python

from keras.models import Model
model.save("wpDL.h5")

f. Load the model in R using rhdf5 package for use in GooglyPlusPlus

library(rhdf5)
dl_model <- load_model_hdf5('wpDL.h5')

This was a huge success for me to be able to create the Deep Learning model in Python and use it in my Shiny app GooglyPlusPlus. The Deep Learning Keras model is light-weight and extremely fast.

The Deep Learning model has now been integrated into GooglyPlusPlus. Now you can check the Win Probability using both a) glmnet (Logistic Regression with lasso regularisation) b) Keras Deep Learning model with dropouts as regularisation

In addition I have created 2 features based on Win Probability (WP)

i) Win Probability (Side-by-side – Plot(interactive) : With this functionality the 1st and 2nd innings will be side-by-side. When the 1st innings is played by team 1, the Win Probability of team 2 = 100 – WP (team1). Similarly, when the 2nd innings is being played by team 2, the Win Probability of team1 = 100 – WP (team 2)

ii) Win Probability (Overlapping) – Plot (static): With this functionality the Win Probabilities of both team1(1st innings) & team 2 (2nd innings) are displayed overlapping, so that we can see how the probabilities vary ball-by-ball.

Note: Since the same UI is used for all match functions I had to re-use the Plot(interactive) and Plot(static) radio buttons for Win Probability (Side-by-side) and Win Probability(Overlapping) respectively

Here are screenshots using both ML models with both functionality for some random matches

B) ICC T20 Men World Cup – Netherland-South Africa- 2022-11-06

i) Match Worm wicket chart

ii) Win Probability with LR (Side-by-Side- Plot(interactive))

iii) Win Probability LR (Overlapping- Plot(static))

iv) Win Probability Deep Learning (Side-by-side – Plot(interactive)

In the 213th ball of the innings South Africa was slightly ahead of Netherlands. After that they crashed and burned!

v) Win Probability Deep Learning (Overlapping – Plot (static)

It can be seen that in the 94th ball of both innings South Africa was ahead of Netherlands before the eventual slump.

C) Intl. T20 (Women) India – New Zealand – 2020 – 02 – 27

Here is an interesting match between India and New Zealand T20 Women’s teams. NZ successfully chased the India’s total in a wildly swinging fortunes. See the charts below

i) Match Worm Wicket chart

ii) Win Probability with LR (Side-by-side – Plot (interactive)

iii) Win Probability with LR (Overlapping – Plot (static)

iv) Win Probability with DL model (Side-by-side – Plot (interactive))

v) Win Probability with DL model (Overlapping – Plot (static))

The above functionality in plotting the Win Probability using LR or DL with both options (Side-by-side or Overlapping) is available for all 9 T20 leagues currently supported by GooglyPlusPlus.

Go ahead and give gpp2023-1 a try!!!

Do also check out my other posts’

To see all posts click Index of posts

# GooglyPlusPlus2022 optimizes batting/bowling lineup

GooglyPlusPlus2022 is the new avatar of last year’s GooglyPlusPlus2021. Roughly, about 5 years back I had written a post on Using linear programming to optimize T20 batting and bowling line up. This post has been on the back of my mind for a long time and I decided to pay this post a revisit. This requires computing performance of individual batsmen vs bowlers and vice-versa for performing the optimization. So in this latest incarnation, there are 4 new functions

1. batsmanVsBowlerPerf – Performance of batsmen against chosen bowlers
2. bowlerVsBatsmanPerf – Performance of bowlers versus specific batsmen
3. battingOptimization – Optimizing batting line up based on strike rates ad remaining overs
4. bowlingOptimization – Optimizing bowling line up based on economy rates and remaining overs

These 4 functions have been incorporated in all the supported 9 T20 formats namely a. IPL b. Intl. T20(men) c. Intl. T20 (women) d. BBL e. NTB f. PSL g. WBB h. CPL i. SSM

Check out GooglyPlusPlus2022!!

You can clone/fork the code for GooglyPlusPlus2022 from Github from gpp2022-1

With this latest update you can do a myriad of analyses of batsmen, bowlers, teams, matches. This is just-in-time for the IPL Mega-auction!! Do check out these other posts of GooglyPlusPlus for other detailed analysis

A) Batsman Vs Bowlers – This option computes the performance of individual batsman against individual bowlers

a) IPL Batsmen vs Bowlers

Included below are the performances of Dhoni, Raina and Kohli against Malinga, Ashwin and Bumrah. Note: The last 2 text box input are not required for this.

b) Intl. T20 (men) Batsmen vs Bowlers

Note: You can type the name and choose from the drop down list

B) Bowler vs Batsmen – You can check the performance of specific bowlers against specific batsmen

a) Intl. T20 (women) India vs Australia

b) PSL Bowlers vs Batsmen

C) Strategy for optimizing batting and bowling line up

From the above 2 tabs, it is obvious, that different bowlers have different ER and wicket rate against different batsmen. In other words, the effectiveness of the bowlers varies by batsmen. Conversely, batsmen are more comfortable with certain bowlers versus others and this shows up in different strike rates.

Hence during the death overs, when trying to restrict batsmen to a certain score or on the flip side when the batting side needs to score a target within certain overs, we need to take advantage of the relative effectiveness of bowlers vs batsmen for optimising bowling and aggressiveness of batsmen versus bowlers to quickly reach the target.

This is the approach that is used for bowling and batting optimisation. For optimising bowling, we need to formulate a minimisation problem based on ER rates and for optimising batting, a maximisation strategy is chosen based on SR. ‘Integer programming’ is used to compute during the last set of overs

This latest version includes optimization using “integer programming” based on R package lpSolve.

Here are the 2 formulations

Assume there are 3 bowlers – $bwlr_{1},bwlr_{2},bwlr_{3}$
and there are 3 batsmen – $bman_{1},bman_{2},bman_{3}$

## I) LP Formulation for bowling order

Let the economy rate $er_{ij}$ be the Economy Rate of the jth bowler to the ith batsman. Also if remaining overs for the bowlers are $o_{1},o_{2},o_{3}$
and the total number of overs left to be bowled are
$o_{1}+o_{2}+o_{3} = N$

Let the economy rate $er_{ij}$ be the Economy Rate of the jth bowler to the ith batsman.
Objective function : Minimize –
$er_{11}*o_{11} + er_{12}*o_{12} +..+er_{1n}*o_{1n}+ er_{21}*o_{21} + er_{22}*o_{22}+.. + er_{22}*o_{2n}+ er_{m1}*o_{m1}+..+ er_{mn}*o_{mn}$
i.e.
$\sum_{i=1}^{i=m}\sum_{j=1}^{i=n}er_{ij}*o_{ij}$
Constraints
Where $o_{j}$ is the number of overs remaining for the jth bowler against  ‘k’ batsmen
$o_{j1} + o_{j2} + .. o_{jk} < o_{j}$
and if the total number of overs remaining to be bowled is N then
$o_{1} + o_{2} +...+ o_{k} = N$ or
$\sum_{j=1}^{j=k} o_{j} =N$
The overs that any bowler can bowl is $o_{j} >=0$

## II) LP Formulation for batting lineup

Let the strike rate $sr_{ij}$  be the Strike Rate of the ith batsman to the jth bowler
Objective function : Maximize –
$sr_{11}*o_{11} + sr_{12}*o_{12} +..+ sr_{1n}*o_{1n}+ sr_{21}*o_{21} + sr_{22}*o_{22}+.. sr_{2n}*o_{2n}+ sr_{m1}*o_{m1}+..+ sr_{mn}*o_{mn}$
i.e.
$\sum_{i=1}^{i=4}\sum_{j=1}^{i=3}sr_{ij}*o_{ij}$
Constraints
Where $o_{j}$ is the number of overs remaining for the jth bowler against  ‘k’ batsmen
$o_{j1} + o_{j2} + .. o_{jk} < o_{j}$
and the total number of overs remaining to be bowled is N then
$o_{1} + o_{2} +...+ o_{k} = N$ or
$\sum_{j=1}^{j=k} o_{j} =N$
The overs that any bowler can bowl is
$o_{j} >=0$

C) Optimized bowling lineup

a) IPL – Optimizing bowling line up

Note: For computing the Optimal bowling lineup, the total number of overs remaining and the number of overs for each bowler have to be entered.

b) PSL – Optimizing batting line up

d) Optimized batting lineup

a) Intl. T20 (men) India vs England

b) Carribean Premier LeagueOptimizing batting line up

Give GooglyPlusPlus2022 a spin!

You can also check the code here gpp2022-1

Hope you have a good time with GooglyPlusPlus2022!

Also see

To see all posts click Index of posts

# GooglyPlusPlus2021: Towards more picturesque analytics!

Analytics for e.g. sports analytics, business analytics or analytics in e-commerce or in other domain has 2 main requirements namely a) What kind of analytics (set of parameters,function) will squeeze out the most intelligence from the data b) How to represent the analytics so that an expert can garner maximum insight?

While it may appear that the former is more important, the latter is also equally, if not, more vital to the problem. Indeed, a picture is worth a thousand words, and often times is more insightful than a large table of numbers. However, in the case of sports analytics, for e.g. in cricket a batting or bowling scorecard captures more information and can never be represented in chart.

So, my Shiny app GooglyPlusPlus includes both charts and tables for different aspects of the analysis. In this post, a newer type of chart, popular among senior management experts, namely the 4 quadrant graph is introduced, which helps in categorising batsmen and bowlers into 4 categories as shown below

a) Batting Performances – Top right quadrant (High runs, High Strike rate)

b) Bowling Performances – Bottom right quadrant( High wickets, Low Economy Rate)

A. Match Tab

All the functions below are at match level

1. Team Runs vs SR Plot
2. Team Wickets vs ER Plot
3. Team Runs vs SR Power play plot
4. Team Runs vs SR Middle overs plot
5. Team Runs vs SR Death overs plot
6. Team Wickets vs ER Power Play
7. Team Wickets vs ER Middle overs
8. Team Wickets vs ER Death overs

The below functions are based on all matches between 2 teams’

1. Team Runs vs SR Plot all Matches
2. Team Wickets vs ER Plot all Matches
3. Team Runs vs SR Power play plot all Matches
4. Team Runs vs SR Middle overs plot all Matches
5. Team Runs vs SR Death overs plot all Matches
6. Team Wickets vs ER Power Play plot all Matches
7. Team Wickets vs ER Middle overs plot all Matches
8. Team Wickets vs ER Death overs plot all Matches

C. Team Performance tab

The below functions are based on a team’s performance against all other teams

1. Team Runs vs SR Plot overall
2. Team Wickets vs ER Plot overall
3. Team Runs vs SR Power play plot overall
4. Team Runs vs SR Middle overs plot overall
5. Team Runs vs SR Death overs plot overall
6. Team Wickets vs ER Power Play overall
7. Team Wickets vs ER Middle overs overall
8. Team Wickets vs ER Death overs overall

D. T20 format Batting Analysis

This analysis is at T20 format level (IPL, Intl. T20(men), Intl. T20 (women), PSL, CPL etc.)

1. Overall Runs vs SR plot
2. Overall Runs vs SR Power play plot
3. Overall Runs vs SR Middle overs plot
4. Overall Runs vs SR Death overs plot

E. T20 Bowling Analysis

This analysis is at T20 format level (IPL, Intl. T20(men), Intl. T20 (women), PSL, CPL etc.)

1. Overall Wickets vs ER plot
2. Team Wickets vs ER Power Play
3. Team Wickets vs ER Middle overs
4. Team Wickets vs ER Death overs

These 32 functions have been added to my yorkr package and so all these functions become plug-n-play in my Shiny app GooglyPlusPlus2021 which means that the 32 functions apply across all the nine T20 formats that the app supports i.e. IPL, Intl. T20 (men), Intl. T20 (women), BBL, NTB, PSL, CPL, SSM, WBB.

Hence the multiplicative factor of the new addition is 32 x 9 = 288 additional ways of exploring match, team and player data

The data for GooglyPlusPlus is taken from Cricsheet. My shiny app GooglyPlusPlus2021 is based on my R package yorkr.

You can clone/fork GooglyPlusPlus from Github at gpp2021-10

Check out my app GooglyPlusPlus2021 and analyze batsmen, bowlers, teams, overall performance. The data for all the nine T20 formats have been updated to include the latest data.

Hence, the app is just in time for the IPL mega auction. You should be able to analyse players in IPL, Intl. T20 or in any of the other formats from where they could be drawn and check out their relative standings

I am including some random plots to demonstrate the newly minted functions

Note 1: All plots are interactive. The controls are on the top right. You can hover over data, zoom-in, zoom-out, compare data etc by choosing the appropriate control. To know more about how to use the interactive charts see GooglyPlusPlus2021 is now fully interactive!!!

You can also check my short video on how to navigate interactive charts

Note 2: To know about Powerplay, Middle overs and Death over analysis see my post GooglyPlusPlus2021 now with power play, middle and death over analysis

Note 3: All tabs(except Match tab) now include Date range pickers to focus on the period of interest. See my post GooglyPlusPlus2021 enhanced with drill-down batsman, bowler analytics

I) Match tab

New Zealand vs Australia (2021-11-14)

New Zealand batting, except K Williamson, the rest did not fire as much

For Australia, Warner, Maxwell and Marsh played good knocks to wrest control

a) Wickets vs ER during Power play of Mumbai Indians in all matches against Chennai Super Kings (IPL)

b) Karachi Kings Runs vs SR during middle overs against Multan Sultans (PSL)

c) Wickets vs ER during death overs of Barbados Tridents in all matches against Jamaica Tallawahs (CPL)

III) Teams overall batting performance

India’s best T20 performers in Power play since 2018 (Intl. T20)

e) Australia’s best performers in Death overs since Mar 2017 (Intl. T20)

f) India’s Intl. T20 (women) best Runs vs SR since 2018

g) England’s Intl. T20 (women) best bowlers in Death overs

IV) Overall Batting Performance across T20

This tab gives the batsmen’s rank and overall batting performance across the T20 format.

a) Why was Hardik Pandya chosen, and why this was in error?

Of course, it provides an insight into why Hardik Pandya was chosen in India’s World cup team despite poor performances recently. Here are the best Intl. T20 death over batsmen

Of course, we can zoom in to get a better look

This is further substantiated when we performances in IPL

However, if you move the needle forward a year at a time, you see Hardik Pandya’s performance drops significantly

and further down

Rather, Dinesh Karthik, Sanju Samson or Ruturaj Gaikwad would have been better options

b) Best batsmen Intl. T20 (women) in Power play since 2018

V) Overall bowling performance

This tab gives the bowler’s rank and overall bowling performance in Power play, middle and death overs across all T20 formats

a) Intl. T20 (men) best bowlers in Power Play from 2019 (zoomed in)

b) Intl. T20(men) best bowlers in Death overs since 2019

c) Was B. Kumar a good choice for India team in World cup?

Bhuvi was one of India’s best bowler in Power play only if we go back to the beginning of time

i) From 2008

But if we move forward to 2020 onwards we see Arshdeep Singh or D Chahar would have been a better choice

ii) From 2020 onwards

iii) 2021 onwards

Hence D Chahar & Arshdeep Singh are the natural choice moving forwards for India

iv) T20 Best batsman

If we look at Intl. T20 performances since 2017, Babar Azam leads the pack, however his Strike rate needs to move up.

v) T20 best bowlers

As mentioned above go ahead and give GooglyPlusPlus2021 a spin!!!

You can download/fork the code for the Shiny app from Github at gpp2021-10

Also see

To see all posts click Index of posts

# GooglyPlusPlus2021 now with power play, middle and death over analysis

This latest edition of GooglyPlusPlus2021 now includes detailed analysis of teams, batsmen and bowlers in power play, middle and death overs. The T20 format is based on 3 phases as each side faces 20 overs.

Power play: Overs: 0 – 6 – No more than 2 players can be outside the 30 yard circle

Middle overs: Overs: 7- 16 – During these overs the batting side tries to consolidate their innings

Death overs: Overs: 16 -20 – During these 5 overs the batting side tries to accelerate the scoring rate, while the bowling side will try to restrict the batsmen against going for big hits

This is shown below

This latest update of GooglyPlusPlus2021 includes the following functions

a) Match tab

1. teamRunsAcrossOvers
2. teamSRAcrossOvers
3. teamWicketsAcrossOvers
4. teamERAcrossOvers
5. matchWormWickets

1. teamRunsAcrossOversOppnAllMatches
2. teamSRAcrossOversOppnAllMatches
3. teamWicketsAcrossOversOppnAllMatches
4. teamERAcrossOversOppnAllMatches
5. topRunsBatsmenAcrossOversOppnAllMatches
6. topSRBatsmenAcrossOversOppnAllMatches
7. topWicketsBowlersAcrossOversOppnAllMatches
8. topERBowlerAcrossOverOppnAllMatches

c) Overall performance tab

1. teamRunsAcrossOversAllOppnAllMatches
2. teamSRAcrossOversAllOppnAllMatches
3. teamWicketsAcrossOversAllOppnAllMatches
4. teamERAcrossOversAllOppnAllMatches
5. topRunsBatsmenAcrossOversAllOppnAllMatches
6. topSRBatsmenAcrossOversAllOppnAllMatches
7. topWicketsBowlersAcrossOversAllOppnAllMatches
8. topERBowlerAcrossOverAllOppnAllMatches

Hence a total of 8 + 8 + 5 = 21 functions have been added. These functions can be utilized across all the 9 T20 formats that are supported in GooglyPlusPlus2021 namely

i) IPL ii) Intl. T20 (men) iii) Intl. T20 (women) iv) BBL v) NTB vi) PSL vii) CPL viii) SSM ix) WBB

Hence there are a total of 21 x 9 = 189 new possibilities to explore in GooglyPlusPlus2021

GooglyPlusPlus2021 is based on my R package yorkr and is based on data from Cricsheet. To know how to use GooglyPlusPlus see any of earlier posts GooglyPlusPlus2021 is now fully interactive!!!, GooglyPlusPlus2021 adds new bells and whistles!!, GooglyPlusPlus2021 enhanced with drill-down batsman, bowler analytics

Take GooglyPlusPlus for a spin here GooglyPlusPlus2021-9

You can clone/fork the code for the Shiny app from Github – gpp2021-9

Included below is a random selection of options from the 189 possibilities mentioned above. Feel free to try out for yourself

A) IPL – CSK vs KKR 2018-04-10

a) Team Runs in power play, middle and death overs

b) Team Strike rate in power play, middle and death overs

B) Intl. T20 (men) – India vs Afghanistan (2021-11-03)

a) Team wickets in power play, middle and death overs

b) Team Economy rate in power play, middle and death overs

a) Team Runs in all matches in power play, middle and death overs

a) Team vs team Strike rate : Karachi Kings vs Lahore Qalanders since 2019 in power play, middle and death overs

E) Team overall performance in all matches against all opposition

a) BBL : Brisbane Heats : Team Wickets between 2015 – 2018 in power play, middle and death overs

F) Top Runs and Strike rate Batsman of Mumbai Indians vs Royal Challengers Bangalore since 2018

a) Top runs scorers for Mumbai Indians (MI) in power play, middle and death overs

b) Top strike rate for RCB in power play, middle and death overs

F) Intl. T20 (women) India vs England since 2018

a) Top wicket takers for England in power play, middle and death overs since 2018

b) Top wicket takers for India in power play, middle and death overs since 2018

G) Intl. T20 (men) All time best batsmen and bowlers for India

a) Most runs in power play, middle and death overs

b) Highest strike rate in power play, middle and death overs

H) Match worm wicket chart

Note: You can zoom to the area where you would like to focus more

The option of looking at the Match worm chart (without wickets) also exists.

Go ahead take GooglyPlusPlus2021 for a test drive and check out how your favourite players perform in power play, middle and death overs. Click GooglyPlusPlus2021-9

Hope you have fun with GooglyPlusPlus

You may also like

To see all posts click Index of posts

# GooglyPlusPlus2021:ICC WC T20:Pavilion-view analytics as-it-happens!

This year 2021, we are witnessing a rare spectacle in the cricketing universe, where IPL playoffs are immediately followed by ICC World Cup T20. Cricket pundits have claimed such a phenomenon occurs once in 127 years! Jokes apart, the World cup T20 is underway and as usual GooglyPlusPlus is ready for the action.

GooglyPlusPlus will provide near-real time analytics, by automatically downloading the latest match data daily, processing and organising the match data into appropriate folders so that my R package yorkr can slice and dice the data to provide the pavilion-view analytics.

The charts capture all the breathless, heart-pounding, and nail-biting action in great details in the many tables and plots. Every table and chart tell a story. You just have to ‘read between the lines!’

GooglyPlusPlus2021 will update itself automatically every day, so the data will be current and you can analyse all matches upto the previous day, along with the historical performances of the teams. So make sure you check it everyday.

Note:

1. All charts are interactive. To know how to use the interactive charts see my post GooglyPlusPlus2021 is now fully interactive!!!
2. The are 5 tabs for each of the formats supported by GooglyPlusPlus2021 which now supports IPL, Intl. T20(men), Intl. T20(women), BBL, NTB, PSL, CPL, SSM, WBB. Besides, it also supports ODI (men) and ODI (women)
3. Each of the formats have 5 tabs – Batsman, Bowler, Match, Head-to-head and Overall Performace.
4. All T20 formats also include a ranking functionality for the batsmen and bowlers
5. You can now perform drill-down analytics for batsmen, bowlers, head-to-head and overall performance based on date-range selector functionality. The ranking tabs also include date range selector granular analysis. For more details see GooglyPlusPlus2021 enhanced with drill-down batsman, bowler analytics

Try out GooglyPlusPlus2021 here gpp2021-8!!

You can clone fork the code from Github gpp2021-8

I am including some random screenshots of things that can be done with GooglyPlusPlus2021

A. Papua New Guinea vs Oman (2021-10-17)

a. Batting partnership

B. Match worm chart (New Papua Guinea v Oman)

This was a no contest as Oman cruised to victory

b. March worm chart (Scotland vs Bangladesh)

Fortunes see-sawed one way, then another, as can be seen in the match worm chart

C. Netherlands vs Ireland (2021-10-18)

a. Batman vs Bowler

a. Sri Lanka vs West Indies (2019-2021) – Batting partnerships

b. India vs England (2018 – 2021) – Bowling scorecard

c) Australia vs South Africa – Team wicket opposition

E) Overall performance

a. Pakistan batting scorecard since 2019

a. Win loss of Australia since 2019

F) Batsman Performance

a. PR Stirling’s runs against opposition since 2019

b. KJ Brien’s cumulative average runs since 2019

G. Bowler performance

a. PWH De Silva’s wicket prediction since 2019

b. T Shamsi’s cumulative average wickets since 2019

H. Ranking Intl. T20 batsman since 2019

a. Runs over Strike rate

b. Strike rate over runs

I. Ranking bowlers since 2019

a. Wickets over Economy rate

b. Economy rate over wickets

As mentioned above GooglyPlusPlus2021 will be updated daily automatically, so you won’t miss any analytic action.

Do give GooglyPlusPlus2021 a spin!

Clone/fork the code for the Shiny app from Github gpp2021-8

You may also like

To see all post click Index of posts

# GooglyPlusPlus2021 enhanced with drill-down batsman, bowler analytics

This latest update to GooglyPlusPlus2021 includes the following changes

a) All the functions in the ‘Batsman’ and ‘Bowler ‘tabs now include a date range, which allows you specify a period of interest.

b) The ‘Rank Batsman’ and ‘Rank Bowler’ tabs also include a date range selector, against the earlier version which had a ‘Since year’ slider see GooglyPlusPlus2021 bubbles up top T20 players in all formats!. The earlier ‘Since year’ slider option could only rank for the latest year or for all years up to the current year. Now with the new ‘date range’ picker we can check the batsman and bowler ranks in any IPL season or (any T20 format) or for a range of years.

There are 10 batsman functions and 9 bowler function that have changed for the following T20 and ODI formats and Rank batsman and bowler includes the ‘date range’ and has changed for all T20 formats.

GooglyPlusPlus2021 supports all the following T20 formats

i) IPL ii) Intl T20(men) iii) Intl T20(women) iv) BBL v) NTB vi) PSL vii) WBB viii) CPL ix) SSM T20 formats – ( 9 T20 panels)

i) ODI (men) ii) ODI (women) – 2 ODI panels

i.e. the changes impact (10 + 9) x 11 + (1 + 1 ) x 9 = 227 tabs which have been changed

The addition of date range enables a fine-grained analysis of players as the players progress through the years.

Note: All charts are interactive. To see how to use interactive charts of GooglyPlusPlus2021 see

GooglyPlusPlus2021 is now fully interactive!!!

GooglyPlusPlus2021 is based on my R package yorkr. The data is take from Cricsheet

You can clone/fork this latest version of GooglyPlusPlus2021 from Github at gpp2021-7

Check out the Shiny app here GooglyPlusPlus2021!!!

I have included some random screen shots of some of using these tabs and options in GooglyPlusPlus2021.

A) KL Rahul’s Cumulative average in IPL 2021 vs IPL 2020

a) KL Rahul in IPL 2021

b) KL Rahul in IPL 2020

B) Performance of Babar Azam in Intl. T20 (men)

a) Babar Azam’s cumulative average from 2019

b) Babar Azam’s Runs against opposition since 2019

Note: Intl. T20 (women) data available upto Mar 2020 from Cricsheet

a) A J Healy performance between 2010 – 2015

b) A J Healy performance between 2015 – 2020

D) M S Dhoni’s performance with the bat pre-2020 and post 2020

There has been a significant decline in Dhoni’s performance in the last couple of years

I) Dhoni’s performance from Jan 2010 to Dec 2019

a) Moving average at 25+ (Dhoni before)

The moving average actually moves up…

b) Cumulative average at 25+ (Dhoni before)

c) Cumulative Strike rate 140+ (Dhoni before)

d) Dhoni’s moving average is ~10-12 (post 2020)

e) Dhoni’s cumulative average (post 2020)

f) Dhoni’s strike rate ~80 (post 2020)

E) Bumrah’s performance in IPL

a) Bumrah’s performance in IPL 2020

b) Bumrah’s performance in IPL 2021

F) Moving average wickets for A. Shrubsole in ODI (women)

G) Chris Jordan’s cumulative economy rate

We can see that Jordan has become more expensive over the years

G) Ranking players

In this latest version the ‘Since year slider’ has been replaced with a Date Range selector. With this we can identify the player ranks in any IPL, CPL, PSL or BBL season. We can also check the performance over the last couple of years. Note: The matches played and Runs over Strike rate or Strike rate over runs can be computed. Similarly for bowlers we have Wickets over Economy rate and Economy rate over wickets options.

a) Ranking IPL batsman in IPL season 2020

b) Ranking Intl. T20 (batsmen) from Jan 2019 to Jul 2021

c) Ranking Intl. T20 bowlers (women) from Jan 2019 – Jul 2021

d) Best IPL bowlers over the last 3 seasons (Wickets over Economy rate)

e) Best IPL bowlers over the last 3 seasons (Economy rate over wickets)

Take GooglyPlusPlus2021 for a spin!!

Hope you have fun checking out the different tabs with the different options!!

Also see

# GooglyPlusPlus2021: Restarting IPL 2021 as-it-happens!!!

The IPL 2021 extravaganza has restarted again, now in Dubai, and it was time for me to crank up good ol’ GooglyPlusPlus2021. As in my earlier post, GooglyPlus2021 with IPL 2021 as it happens, during the initial set of IPL 2021 games,, a command script will execute automatically every day, download the latest data files, unzip, sort, process and put them in appropriate directories so that GooglyPlusPlus can work its magic on the data, with my R package yorkr. You can do analysis of IPL 2021 matches, batsmen, bowlers, historical performance analysis of head-to-head clashes and performances of teams.

Note: Since the earlier instalment of IPL 2021, there are 2 key changes that have taken place in GooglyPlusPlus.

Now,

a) All charts are interactive. You can hover over charts, click, double-click to get more details. To see more details on how to use the interactive charts, see my post GooglyPlusPlus2021 is now fully interactive!

b) You can now analyse historical performances, compute team batting and bowling scorecards for specified periods. To know details see GooglyPlusPlus2021 adds new bells and whistles!

You can try out my app GooglyPlusPlus2021 by clicking GooglyPlusPlus2021

The code for my R package yorkr is available at Github at yorkr

You can clone/fork GooglyPlusPlus2021 from github at gpp2021-6

Some key analysis and highlights of the 2 recently concluded IPL matches

• CSK vs MI
• KKR vs RCB

a) CSK vs MI (19 Sep 2021) – Batting Partnerships (CSK)

b) CSK vs MI (19 Sep 2021) – Bowling scorecard (MI)

c) CSK vs MI (19 Sep 2021) – Match worm chart

Even though MI had a much better start and were cruising along to a victory, they lost the plot around the 18.1 th over as seen below (hover on the chart)

d) KKR vs RCB ( 20 Sep 2021) – Bowling wicket match

This chart gives the wickets taken by the bowler and the total runs conceded

e) KKR vs RCB ( 20 Sep 2021) – Match worm chart

This was a no contest. RCB batting was pathetic and KKR blasted their way to victory as seen in this worm chart

Note: You can also do historical analysis of teams with GooglyPlusPlus2021

For the match to occur today PBKS vs RR (21 Sep 2021) we can perform head-to-head historical analysis. Here Kings XI Punjab has been chosen instead of Punjab Kings as that was its name.

For the Rajasthan Royals Sanjy Samson and Jos Buttler have the best performance from 2018 -2021 as seen below

For Punjab Kings KL Rahul and Chris Gayle are the leading scorers for the period 2018-2021

g) Current ranking of batsmen IPL 2021

h) Current ranking of bowlers IPL 2021

Also you analyse individual batsman and bowlers

i) Batsman analysis

To see Rituraj Gaikwad performance checkout the batsman tab

j) Bowler analysis

Performance of Varun Chakaravarty

Remember to check out GooglyPlusPlus2021 for your daily analysis of matches, teams, batsmen and bowlers. Your ride will be waiting for you!!!

You can clone/fork GooglyPlusPlus2021 from github at gpp2021-6

GooglyPlusPlus2021 has been updated with all completed 31 matches

Also see

To see all posts click Index of posts

# GooglyPlusPlus2021 is now fully interactive!!!

GooglyPlusPlus2021 is now fully interactive. Please read the below post carefully to see the different ways you can interact with the data in the plots.

a) GooglyPlusPlus gets all ‘touchy, feely‘ with the data and now you can interact with the plot/chart to get more details of the underlying data. There are many ways you can slice’n dice the data in the charts. The examples below illustrate a few of this. You can interact with plots by hover’ing, ‘click’ing and ‘double-click’ing curves, plots, barplots to get details of the data.

b) GooglyPlusPlus also includes the ‘Super Smash T20’ league from New Zealand. You can analyze batsmen, bowlers, matches, teams and rank Super Smash (SSM) also

Note: GooglyPlusPlus2021 can handle a total of 11 formats including T20 and ODI. They are

i) IPL ii) Intl. T20(men) ii) Intl. T20(women) iv) BBL

v) NTB vi) PSL vii) WBB. viii) CPL

ix) SSM x) ODI (men) xi) ODI (women)

Each of these formats have 7 tabs which are

— Analyze batsman

— Analyze bowlers

— Analyze match

— Team vs all other teams

— Rank batsmen

— Rank bowlers

Within these 11 x 7 = 77 tabs you can analyze batsmen, bowlers, matches, head-to-head, team vs all other teams and rank players for T20 and ODI. In addition all plots have been made interactive so there is a lot more information that you can get from these charts

Try out the interactive GooglyPlusPlus2021 now!!!

You can fork/clone the Shiny app from Github at GooglyPlusPlus2021

Below I have randomly included some charts for different formats to show how you can interact with them

a) Batsman Analysis – Runs vs Deliveries (IPL)

Mouse-over/Hover

The plot below gives the number of runs scored by David Warner vs Deliveries faced.

b) Batsman Analysis – Runs vs Deliveries (IPL) (prediction)

Since a 2nd order regression line,with confidence intervals(shaded area), has been fitted in the above plot, we can predict the runs given the ‘balls faced’ as below

Click ‘Toggle Spike lines’ (use palette on top-right)

By using hover(mouse-over) on the curve we can determine the predicted number of runs Warner will score given a certain number of deliveries

c) Bowler Analysis – Wickets against opposition – Intl. T20 (women)

Jhulan Goswami’s wickets against opposition countries in Intl. T20 (women)

d) Bowler Analysis (Predict bowler wickets) IPL – (non-interactive**)

Note: Some plots are non-interactive, like the one below which predicts the number of wickets Bumrah will take based on number of deliveries bowled

e) Match Analysis – Batsmen Partnership -Intl. T20 (men)

India vs England batting partnership between Virat Kohli & Shikhar Dhawan in all matches between England and India

f) Match Analysis – Worm chart (Super Smash T20) SSM

i) Worm chart of Auckland vs Northern Districts (29 Jan 2021).

ii) The final cross-over happens around the 2nd delivery of the 19th over (18.2) as Northern Districts over-takes Auckland to win the match.

Batting performance of Shakib-al-Hasan (Bangladesh) against Afghanistan bowlers in Intl. T20 (men)

Double click on Shakib-al-Hasan on the legend to get the performance of Shakib-al-Hasan against Afghanistan bowlers

Avoiding the clutter

i) Head-to-head – Team bowler vs batsmen (Chennai Super Kings bowlers vs Mumbai Indians batsmen) – IPL

If you choose the above option the resulting plot is very crowded as shown below

To get the performance of Mumbai Indian (MI) batsmen (Rohit Sharma & Kieron Pollard) against Chennai Super Kings (CSK) bowlers in all matches do as told below

Steps to avoid clutter in stacked bar plots

1) This can be avoided by selectively choosing to filter out the batsmen we are interested in. say RG Sharma and Kieron Pollard. Then double-ciick RG Sharma, this is will bring up the chart with only RG Sharma as below

2) Now add additional batsmen you are interested in by single-clicking. In the example below Kieron Pollard is added

You can continue to add additional players that you are interested by single clicking.

In the plot V Kohli, MS Dhoni and SC Ganguly have been selected for their performance against Australian bowlers (use toggle spike lines)

k) Overall Performance – PSL batting partnership against all teams (Fakhar Zaman)

The plot below shows Fakhar Zaman (Lahore Qalanders) partnerships with other teammates in all matches in PSL.

l) Win-loss against all teams (CPL)

Win-loss chart of Jamaica Talawallahs (CPL) in all matches against all opposition

m) Team batting partnerships against all teams for India (ODI Women)

Batting partnerships of Indian ODI women against all other teams

n) Ranking of batsmen (IPL 2021)

Finally here is the latest ranking of IPL batsmen for IPL 2021 (can be done for all other T20 formats)

o) Ranking of bowlers (IPL 2021)

So what are you waiting for? Go ahead and try out GooglyPlusPlus2021!

Knock yourself out!

Enjoy enjaami!!!

To see all posts click Index of posts

# GooglyPlusPlus2021 bubbles up top T20 players in all formats!

“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

– 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

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

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

To see all post click Index of posts