Skip to content

Using pytorch to build a neural network to predict the 2022 World Cup Give the probability of winning and losing for each game separately

Notifications You must be signed in to change notification settings

yinpu/FIFA-WORLD-CUP-PREDICTION

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

2022 FIFA WORLD CUP PREDICTION

Using pytorch to build a neural network to predict the 2022 World Cup

Give the probability of winning and losing for each game separately

The training data comes from kaggle (https://www.kaggle.com/datasets/martj42/international-football-results-from-1872-to-2017)

Instructions

  1. Download the data from the above kaggle link and decompress it, and place the results.csv in the ./data directory

  2. python preprocess.py
  3. python main.py
  4. The output is in ./data/pred.csv

Here are the predicted results

home_team away_team home_team_loss home_team_win home_team_draw
0 Qatar Ecuador 0.43832436203956604 0.3241387605667114 0.23753690719604492
1 Senegal Netherlands 0.8146077990531921 0.08299645781517029 0.1023956760764122
2 England Iran 0.10977872461080551 0.7393050789833069 0.150916188955307
3 United States Wales 0.4844847321510315 0.3573998510837555 0.1581154316663742
4 Argentina Saudi Arabia 0.06608234345912933 0.7922183275222778 0.14169932901859283
5 Mexico Poland 0.4614976644515991 0.32846954464912415 0.21003274619579315
6 Denmark Tunisia 0.2634960114955902 0.5287051200866699 0.20779883861541748
7 France Australia 0.26930108666419983 0.6184151768684387 0.11228371411561966
8 Germany Japan 0.1238890290260315 0.7331917881965637 0.14291918277740479
9 Spain Costa Rica 0.14859357476234436 0.6584973335266113 0.1929091364145279
10 Morocco Croatia 0.6307979822158813 0.1604074239730835 0.20879463851451874
11 Belgium Canada 0.09586668759584427 0.8012700080871582 0.10286331921815872
12 Switzerland Cameroon 0.26291173696517944 0.46560153365135193 0.271486759185791
13 Brazil Serbia 0.17897723615169525 0.6597122550010681 0.16131047904491425
14 Uruguay South Korea 0.2594752907752991 0.4751227796077728 0.2654018700122833
15 Portugal Ghana 0.23299959301948547 0.5963274836540222 0.17067290842533112
16 Qatar Senegal 0.3303745687007904 0.42403876781463623 0.24558669328689575
17 Netherlands Ecuador 0.09825852513313293 0.7737862467765808 0.12795525789260864
18 Wales Iran 0.4309306740760803 0.4346366822719574 0.13443270325660706
19 England United States 0.14756451547145844 0.6854586005210876 0.16697683930397034
20 Poland Saudi Arabia 0.16117233037948608 0.6589977741241455 0.179829940199852
21 Argentina Mexico 0.2075396180152893 0.5802081227302551 0.21225225925445557
22 Tunisia Australia 0.3612756133079529 0.3422435522079468 0.29648083448410034
23 France Denmark 0.5277354121208191 0.379800021648407 0.09246461093425751
24 Japan Costa Rica 0.39247211813926697 0.39483439922332764 0.2126934677362442
25 Spain Germany 0.50408536195755 0.3060823678970337 0.18983221054077148
26 Belgium Morocco 0.2701772153377533 0.5029365420341492 0.22688625752925873
27 Croatia Canada 0.04068133234977722 0.8759750127792358 0.08334363996982574
28 Cameroon Serbia 0.6986231803894043 0.14093028008937836 0.16044658422470093
29 Brazil Switzerland 0.14428852498531342 0.6458815932273865 0.2098298966884613
30 South Korea Ghana 0.3239705264568329 0.39121779799461365 0.28481167554855347
31 Portugal Uruguay 0.4403846859931946 0.354835569858551 0.20477978885173798
32 Ecuador Senegal 0.4165593087673187 0.3586595952510834 0.22478114068508148
33 Qatar Netherlands 0.788962185382843 0.08795084059238434 0.12308698147535324
34 Wales England 0.7688230872154236 0.11704124510288239 0.11413561552762985
35 Iran United States 0.4404911994934082 0.3711323142051697 0.18837648630142212
36 Poland Argentina 0.621189534664154 0.180080845952034 0.19872967898845673
37 Saudi Arabia Mexico 0.6524074077606201 0.19572623074054718 0.15186640620231628
38 Australia Denmark 0.6347565054893494 0.22331339120864868 0.14193014800548553
39 Tunisia France 0.5312294363975525 0.26178571581840515 0.20698480308055878
40 Japan Spain 0.7042847871780396 0.1324021965265274 0.16331300139427185
41 Costa Rica Germany 0.8122816681861877 0.08854364603757858 0.09917477518320084
42 Croatia Belgium 0.28506723046302795 0.5130628347396851 0.2018699198961258
43 Canada Morocco 0.6158958077430725 0.16862329840660095 0.21548084914684296
44 Serbia Switzerland 0.2926972806453705 0.48347508907318115 0.22382767498493195
45 Cameroon Brazil 0.8536257743835449 0.04531894996762276 0.10105519741773605
46 Ghana Uruguay 0.7040308713912964 0.15104389190673828 0.1449252963066101
47 South Korea Portugal 0.4871547520160675 0.27046167850494385 0.24238361418247223

2022 世界杯预测

使用pytorch搭建神经网络预测2022年世界杯

分别给出每场比赛的输赢概率

训练数据来自kaggle (https://www.kaggle.com/datasets/martj42/international-football-results-from-1872-to-2017)

使用方法

  1. 从上述链接下载数据集并解压,把results.csv放到./data中

  2. python preprocess.py
  3. python main.py

About

Using pytorch to build a neural network to predict the 2022 World Cup Give the probability of winning and losing for each game separately

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages