Complex interactions between two opposing agents frequently occur in various domains, and analyzing the strategies involved can be both beneficial and challenging. One such critical scenario is shot-taking in football, where decisions such as whether the attacker should shoot or pass the ball and if the defender should attempt to block the shot or not, play a crucial role in the outcome of the game. However, there are currently no effective and data-driven approaches to analyzing such situations.
To address this gap, we have proposed a novel framework that integrates machine learning models, rule-based models, and game theory to analyze the optimal strategies in football shot-taking scenarios. Additionally, we have introduced a novel metric called xSOT to evaluate players' actions in these situations. Overall, we expect that this framework will contribute to and inspire the analysis of complex interaction situations, particularly in the context of sports, where understanding optimal strategies can greatly benefit teams and players.- Install required package (Python 3.9.16)
pip install -r requirements.yml
- Download data from StatsBomb and preprocess the data
python data/data_download_plot.py -o <output_dir>
1.5 Optional: Split the dataset into train and test set
python data/train_test_split.py -d <dataset_path> -o <output_dir>
- Get the xSOT and counterfactual xSOT value
python game_theory.py -d <dataset_path> -o <output_dir>
- Analyze the shot-taking situations with xSOT
python xsot_analysis -r <row_to_analyze> -d <real_df_path> -o <output_dir>
In the code, the parameter scaler_1, scaler_2, scaler_3, sigma, a corresponding to c_1, c_2, c_3, c_4, a in the paper.
calculate_shot_block_prob(index,train,scaler_1=1,scaler_2=1,scaler_3=1,mean=0,sigma=0.4,a=-10,b=10)
xSOT = real_df.loc[<index>, "xSOT"]
xOSOT = real_df.loc[<index>, "xOSOT"]
xSOT = cf_df.loc[<index>, "xSOT"]
xOSOT = cf_df.loc[<index>, "xOSOT"]
Jersey Number | xSOT | P(Shot Off) | P(Shot Block) | P(Control) |
---|---|---|---|---|
9 | 0.27 | 0.32 | 0.22 | 0.59 |
20 | 0.23 | 0.60 | 0.03 | 0.63 |
14 | 0.17 | 0.67 | 0.16 | 0.99 |
12 | 0.15 | 0.63 | 0.20 | 0.89 |
6 | 0.05 | 0.53 | 0.18 | 0.17 |
Shooter | 0.03 | 0.51 | 0.46 | - |
8 | 0.00 | 0.61 | 0.40 | 0.60 |