training.py
Some checks failed
s434732-training/pipeline/head There was a failure building this commit

This commit is contained in:
s434732 2021-05-15 12:04:19 +02:00
parent a8eb0ab145
commit 25e745416d
10 changed files with 42515 additions and 17 deletions

View File

@ -7,6 +7,7 @@ RUN pip3 install kaggle && pip3 install pandas && pip3 install scikit-learn && p
RUN pip3 install torch torchvision torchaudio
RUN apt install -y curl
RUN pip3 install --user wget
RUN pip3 install sacred && pip3 install GitPython && pip3 install pymongo
WORKDIR /app
@ -14,6 +15,7 @@ WORKDIR /app
COPY ./skrypt_download.py ./
COPY ./skrypt_stat.py ./
COPY ./IUM_05.py ./
COPY ./training.py ./
RUN mkdir /.kaggle
RUN chmod -R 777 /.kaggle

Binary file not shown.

View File

@ -6,20 +6,22 @@ import torch.nn.functional as F
from torch.utils.data import DataLoader, TensorDataset, random_split
from sklearn import preprocessing
results = pd.read_csv('results.csv')
# results = pd.read_csv('results.csv')
train = pd.read_csv('train.csv')
test = pd.read_csv('test.csv')
#brak wierszy z NaN
results.dropna()
#normalizacja itp
for collumn in ['home_team', 'away_team', 'tournament', 'city', 'country']:
results[collumn] = results[collumn].str.lower()
categorical_cols = results.select_dtypes(include=object).columns.values
train, test = train_test_split(results, test_size= 1 - 0.4)
#valid, test = train_test_split(test, test_size=0.5)
# results.dropna()
#
# #normalizacja itp
# for collumn in ['home_team', 'away_team', 'tournament', 'city', 'country']:
# results[collumn] = results[collumn].str.lower()
#
categorical_cols = train.select_dtypes(include=object).columns.values
#
#
# train, test = train_test_split(results, test_size= 1 - 0.4)
#
# #valid, test = train_test_split(test, test_size=0.5)
input_cols = train.columns.values[1:-1]
output_cols = train.columns.values[-1:]

53
Jenkinsfile_train Normal file
View File

@ -0,0 +1,53 @@
pipeline {
agent {
dockerfile true
}
parameters{
buildSelector(
defaultSelector: lastSuccessful(),
description: 'Which build to use for copying artifacts',
name: 'WHICH_BUILD'
)
string(
defaultValue: '64',
description: 'batch size',
name: 'BATCH_SIZE'
)
string(
defaultValue: '100',
description: 'epochs',
name: 'EPOCHS'
)
}
stages {
stage('checkout') {
steps {
copyArtifacts fingerprintArtifacts: true, projectName: 's434732-create-dataset', selector: buildParameter('WHICH_BUILD')
}
}
stage('Docker'){
steps{
sh 'python3 "./training.py" ${BATCH_SIZE} ${EPOCHS} > model_pred.txt'
}
}
stage('archiveArtifacts') {
steps{
archiveArtifacts 'ium_s434732/**'
archiveArtifacts 'model_pred.txt'
archiveArtifacts 'FootballModel.pth'
}
}
}
post {
success {
build job: 's434732-evaluation/master'
mail body: 'SUCCESS TRAINING', subject: 's434766', to: '26ab8f35.uam.onmicrosoft.com@emea.teams.ms'
}
failure {
mail body: 'FAILURE TRAINING', subject: 's434732', to: '26ab8f35.uam.onmicrosoft.com@emea.teams.ms'
}
}
}

View File

@ -918,6 +918,7 @@ date,home_team,away_team,home_score,away_score,tournament,city,country,neutral
1925-08-23,Paraguay,Uruguay,0,0,Friendly,Asunción,Paraguay,FALSE
1925-08-26,Estonia,Latvia,2,2,Friendly,Tallinn,Estonia,FALSE
1925-08-30,Finland,Poland,2,2,Friendly,Helsinki,Finland,FALSE
1925-09-02,Estonia,Poland,0,0,Friendly,Tallinn,Estonia,FALSE
1925-09-20,Hungary,Austria,1,1,Friendly,Budapest,Hungary,FALSE
1925-09-20,Latvia,Lithuania,2,2,Friendly,Riga,Latvia,FALSE
1925-09-27,Austria,Spain,0,1,Friendly,Vienna,Austria,FALSE
@ -1343,6 +1344,7 @@ date,home_team,away_team,home_score,away_score,tournament,city,country,neutral
1930-08-17,Brazil,United States,4,3,Friendly,Rio de Janeiro,Brazil,FALSE
1930-08-17,Lithuania,Latvia,3,3,Baltic Cup,Kaunas,Lithuania,FALSE
1930-09-07,Denmark,Germany,6,3,Friendly,Copenhagen,Denmark,FALSE
1930-09-13,Lithuania,Estonia,4,0,Friendly,Klaipeda,Lithuania,FALSE
1930-09-21,Austria,Hungary,2,3,Friendly,Vienna,Austria,FALSE
1930-09-21,Belgium,Czechoslovakia,2,3,Friendly,Antwerp,Belgium,FALSE
1930-09-21,Norway,Denmark,1,0,Nordic Championship,Oslo,Norway,FALSE
@ -1521,6 +1523,7 @@ date,home_team,away_team,home_score,away_score,tournament,city,country,neutral
1932-07-17,Sweden,Austria,3,4,Friendly,Stockholm,Sweden,FALSE
1932-07-24,Latvia,Lithuania,2,1,Friendly,Liepāja,Latvia,FALSE
1932-08-06,Lithuania,Estonia,1,0,Friendly,Kaunas,Lithuania,FALSE
1932-08-17,Estonia,Finland,0,3,Friendly,Tallinn,Estonia,FALSE
1932-08-25,Uganda,Kenya,13,1,Friendly,Kampala,Uganda,FALSE
1932-08-28,Latvia,Lithuania,4,1,Baltic Cup,Riga,Latvia,FALSE
1932-08-29,Estonia,Lithuania,1,2,Baltic Cup,Riga,Latvia,TRUE
@ -1719,6 +1722,7 @@ date,home_team,away_team,home_score,away_score,tournament,city,country,neutral
1934-07-31,Aruba,Suriname,1,1,Friendly,Oranjestad,Aruba,FALSE
1934-08-06,Suriname,Trinidad and Tobago,3,3,Friendly,Paramaribo,Netherlands Guyana,FALSE
1934-08-08,Estonia,Finland,1,1,Friendly,Tallinn,Estonia,FALSE
1934-08-10,Estonia,Hungary,2,2,Friendly,Tallinn,Estonia,FALSE
1934-08-14,Latvia,Finland,1,1,Friendly,Riga,Latvia,FALSE
1934-08-15,Argentina,Uruguay,1,0,Friendly,Avellaneda,Argentina,FALSE
1934-08-16,Lithuania,Finland,1,0,Friendly,Kaunas,Lithuania,FALSE
@ -2124,6 +2128,7 @@ date,home_team,away_team,home_score,away_score,tournament,city,country,neutral
1938-06-19,Hungary,Italy,2,4,FIFA World Cup,Colombes,France,TRUE
1938-06-20,Cuba,Basque Country,3,4,Friendly,Havana,Cuba,FALSE
1938-06-21,Denmark,Sweden,0,1,Nordic Championship,Copenhagen,Denmark,FALSE
1938-06-22,Estonia,Hungary,2,3,Friendly,Tallinn,Estonia,FALSE
1938-06-26,Netherlands,Indonesia,9,2,Friendly,Amsterdam,Netherlands,FALSE
1938-07-04,Finland,Sweden,2,4,Nordic Championship,Helsinki,Finland,FALSE
1938-07-05,Curaçao,Suriname,2,1,Friendly,Willemstad,Curaçao,FALSE
@ -26177,6 +26182,7 @@ date,home_team,away_team,home_score,away_score,tournament,city,country,neutral
2003-12-15,Bahrain,Egypt,0,1,Prime Minister's Cup,Riffa,Bahrain,FALSE
2003-12-15,Iraq,Kenya,2,0,Prime Minister's Cup,Riffa,Bahrain,TRUE
2003-12-16,Kuwait,Lebanon,2,0,Friendly,Paphos,Cyprus,TRUE
2003-12-17,Saudi Arabia,Estonia,1,1,Friendly,Dammam,Saudi Arabia,FALSE
2003-12-18,Bahrain,Kenya,2,1,Prime Minister's Cup,Riffa,Bahrain,FALSE
2003-12-18,Egypt,Iraq,2,0,Prime Minister's Cup,Riffa,Bahrain,TRUE
2003-12-18,Kuwait,Lebanon,0,0,Friendly,Paphos,Cyprus,TRUE
@ -26283,6 +26289,7 @@ date,home_team,away_team,home_score,away_score,tournament,city,country,neutral
2004-02-12,Jordan,Indonesia,2,1,Friendly,Amman,Jordan,FALSE
2004-02-13,Nigeria,Mali,2,1,African Cup of Nations,Monastir,Tunisia,TRUE
2004-02-13,Qatar,Bahrain,2,0,Friendly,Doha,Qatar,FALSE
2004-02-14,Belarus,Estonia,1,2,Friendly,Ta' Qali,Malta,TRUE
2004-02-14,South Korea,Oman,5,0,Friendly,Ulsan,South Korea,FALSE
2004-02-14,Malta,Moldova,0,0,Malta International Tournament,Attard,Malta,FALSE
2004-02-14,Tunisia,Morocco,2,1,African Cup of Nations,Radès,Tunisia,FALSE
@ -26378,6 +26385,7 @@ date,home_team,away_team,home_score,away_score,tournament,city,country,neutral
2004-03-30,Australia,South Africa,1,0,Friendly,London,England,TRUE
2004-03-30,Bolivia,Chile,0,2,FIFA World Cup qualification,La Paz,Bolivia,FALSE
2004-03-30,Israel,Lithuania,2,1,Friendly,Ramat-Gan,Israel,FALSE
2004-03-31,Estonia,Northern Ireland,0,1,Friendly,Tallinn,Estonia,FALSE
2004-03-31,Albania,Iceland,2,1,Friendly,Tirana,Albania,FALSE
2004-03-31,Bermuda,Nicaragua,3,0,Friendly,Hamilton,Bermuda,FALSE
2004-03-31,Bulgaria,Russia,2,2,Friendly,Sofia,Bulgaria,FALSE
@ -33103,12 +33111,14 @@ date,home_team,away_team,home_score,away_score,tournament,city,country,neutral
2011-06-18,Costa Rica,Honduras,1,1,Gold Cup,East Rutherford,United States,TRUE
2011-06-18,Malaysia,Burma,2,0,Friendly,Kota Baharu,Malaysia,FALSE
2011-06-18,Mexico,Guatemala,2,1,Gold Cup,East Rutherford,United States,TRUE
2011-06-19,Chile,Estonia,4,0,Friendly,Santiago,Chile,FALSE
2011-06-19,Anguilla,U.S. Virgin Islands,0,0,Friendly,The Valley,Anguilla,FALSE
2011-06-19,Panama,El Salvador,1,1,Gold Cup,Washington,United States,TRUE
2011-06-19,United States,Jamaica,2,0,Gold Cup,Washington,United States,FALSE
2011-06-20,Argentina,Albania,4,0,Friendly,Buenos Aires,Argentina,FALSE
2011-06-22,Honduras,Mexico,0,2,Gold Cup,Houston,United States,TRUE
2011-06-22,United States,Panama,1,0,Gold Cup,Houston,United States,FALSE
2011-06-23,Uruguay,Estonia,3,0,Friendly,Rivera,Uruguay,FALSE
2011-06-23,Paraguay,Chile,0,0,Friendly,Asunción,Paraguay,FALSE
2011-06-25,Colombia,Senegal,2,0,Friendly,Medellín,Colombia,FALSE
2011-06-25,Kenya,Sudan,1,2,Friendly,Nairobi,Kenya,FALSE
@ -38474,6 +38484,8 @@ date,home_team,away_team,home_score,away_score,tournament,city,country,neutral
2016-11-11,San Marino,Germany,0,8,FIFA World Cup qualification,Serravalle,San Marino,FALSE
2016-11-11,Slovakia,Lithuania,4,0,FIFA World Cup qualification,Trnava,Slovakia,FALSE
2016-11-11,Togo,Comoros,2,2,Friendly,Tunis,Tunisia,TRUE
2016-11-11,Trinidad and Tobago,Costa Rica,0,2,FIFA World Cup qualification,Port of Spain,Trinidad and Tobago,FALSE
2016-11-11,United States,Mexico,1,2,FIFA World Cup qualification,Columbus,United States,FALSE
2016-11-12,Albania,Israel,0,3,FIFA World Cup qualification,Elbasan,Albania,FALSE
2016-11-12,Austria,Republic of Ireland,0,1,FIFA World Cup qualification,Vienna,Austria,FALSE
2016-11-12,Cameroon,Zambia,1,1,FIFA World Cup qualification,Limbe,Cameroon,FALSE
@ -41374,7 +41386,7 @@ date,home_team,away_team,home_score,away_score,tournament,city,country,neutral
2019-10-19,Zambia,Eswatini,2,2,African Nations Championship qualification,Zambia,Zambia,FALSE
2019-10-19,Nigeria,Togo,2,0,African Nations Championship qualification,Nigeria,Nigeria,FALSE
2019-10-20,Congo,Equatorial Guinea,1,0,African Nations Championship qualification,Congo,Congo,FALSE
2019-10-20,DR Congo,Central African Republic,4,1,African Nations Championship qualification,Congo DR,DR Congo,FALSE
2019-10-20,DR Congo,Central African Republic,4,1,African Nations Championship qualification,DR Congo,DR Congo,FALSE
2019-10-20,Libya,Tunisia,1,2,African Nations Championship qualification,Libya,Libya,FALSE
2019-10-20,Lesotho,Zimbabwe,0,0,African Nations Championship qualification,Lesotho,Lesotho,FALSE
2019-10-20,Guinea,Senegal,1,0,African Nations Championship qualification,Conakry,Guinea,FALSE
@ -41676,7 +41688,7 @@ date,home_team,away_team,home_score,away_score,tournament,city,country,neutral
2020-10-08,Paraguay,Peru,2,2,FIFA World Cup qualification,Asunción,Paraguay,FALSE
2020-10-08,Uruguay,Chile,2,1,FIFA World Cup qualification,Montevideo,Uruguay,FALSE
2020-10-08,Argentina,Ecuador,1,0,FIFA World Cup qualification,Buenos Aires,Argentina,FALSE
2020-10-09,Burkina Faso,Congo DR,3,0,Friendly,Mohammedia,Morocco,TRUE
2020-10-09,Burkina Faso,DR Congo,3,0,Friendly,Mohammedia,Morocco,TRUE
2020-10-09,Congo,Gambia,0,1,Friendly,Parchal,Portugal,TRUE
2020-10-09,Japan,Cameroon,0,0,Friendly,Utrecht,Netherlands,TRUE
2020-10-09,Kenya,Zambia,2,1,Friendly,Nairobi,Kenya,FALSE
@ -41737,7 +41749,7 @@ date,home_team,away_team,home_score,away_score,tournament,city,country,neutral
2020-10-13,Costa Rica,Panama,0,1,Friendly,San José,Costa Rica,FALSE
2020-10-13,Japan,Ivory Coast,1,0,Friendly,Utrecht,Netherlands,TRUE
2020-10-13,Mexico,Algeria,2,2,Friendly,The Hague,Netherlands,TRUE
2020-10-13,Morocco,Congo DR,1,1,Friendly,Rabat,Morocco,FALSE
2020-10-13,Morocco,DR Congo,1,1,Friendly,Rabat,Morocco,FALSE
2020-10-13,Mozambique,Angola,0,3,Friendly,Rio Maior,Portugal,TRUE
2020-10-13,Niger,Sierra Leone,1,0,Friendly,Niamey,Niger,FALSE
2020-10-13,Nigeria,Tunisia,1,1,Friendly,Sankt Veit an der Glan,Austria,TRUE
@ -41875,3 +41887,199 @@ date,home_team,away_team,home_score,away_score,tournament,city,country,neutral
2020-11-18,Kazakhstan,Lithuania,1,2,UEFA Nations League,Almaty,Kazakhstan,FALSE
2020-12-04,Qatar,Bangladesh,5,0,FIFA World Cup qualification,Doha,Qatar,FALSE
2020-12-09,United States,El Salvador,6,0,Friendly,Fort Lauderdale,United States,FALSE
2021-01-12,United Arab Emirates,Iraq,0,0,Friendly,Dubai,United Arab Emirates,FALSE
2021-01-18,Kuwait,Palestine,0,1,Friendly,Kuwait City,Kuwait,FALSE
2021-01-19,Dominican Republic,Puerto Rico,0,1,Friendly,Santo Domingo,Dominican Republic,FALSE
2021-01-22,Guatemala,Puerto Rico,1,0,Friendly,Guatemala City,Guatemala,FALSE
2021-01-25,Dominican Republic,Serbia,0,0,Friendly,Santo Domingo,Dominican Republic,FALSE
2021-01-27,Iraq,Kuwait,2,1,Friendly,Basra,Iraq,FALSE
2021-01-28,Panama,Serbia,0,0,Friendly,Panama City,Panama,FALSE
2021-01-31,United States,Trinidad and Tobago,7,0,Friendly,Orlando,United States,FALSE
2021-02-01,Jordan,Tajikistan,2,0,Friendly,Dubai,United Arab Emirates,TRUE
2021-02-05,Jordan,Tajikistan,0,1,Friendly,Dubai,United Arab Emirates,TRUE
2021-02-15,Jordan,Uzbekistan,0,2,Friendly,Dubai,United Arab Emirates,TRUE
2021-02-24,Guatemala,Nicaragua,1,0,Friendly,Guatemala City,Guatemala,FALSE
2021-03-13,Kenya,South Sudan,1,0,Friendly,Nairobi,Kenya,FALSE
2021-03-15,Kenya,Tanzania,2,1,Friendly,Nairobi,Kenya,FALSE
2021-03-17,Ethiopia,Malawi,4,0,Friendly,Bahir Dar,Ethiopia,FALSE
2021-03-20,Oman,Jordan,0,0,Friendly,Dubai,United Arab Emirates,TRUE
2021-03-24,Belarus,Honduras,1,1,Friendly,Zhodzina,Belarus,FALSE
2021-03-24,Jordan,Lebanon,1,0,Friendly,Dubai,United Arab Emirates,TRUE
2021-03-24,Kosovo,Lithuania,4,0,Friendly,Pristina,Kosovo,FALSE
2021-03-24,Qatar,Luxembourg,1,0,Friendly,Debrecen,Hungary,TRUE
2021-03-24,Antigua and Barbuda,Montserrat,2,2,FIFA World Cup qualification,Willemstad,Curaçao,TRUE
2021-03-24,Suriname,Cayman Islands,3,0,FIFA World Cup qualification,Paramaribo,Suriname,FALSE
2021-03-24,Guatemala,Cuba,1,0,FIFA World Cup qualification,Guatemala City,Guatemala,FALSE
2021-03-24,Dominican Republic,Dominica,1,0,FIFA World Cup qualification,Santo Domingo,Dominican Republic,FALSE
2021-03-24,Saint Kitts and Nevis,Puerto Rico,1,0,FIFA World Cup qualification,San Cristóbal,Dominican Republic,TRUE
2021-03-24,Portugal,Azerbaijan,1,0,FIFA World Cup qualification,Turin,Italy,TRUE
2021-03-24,Serbia,Republic of Ireland,3,2,FIFA World Cup qualification,Belgrade,Serbia,FALSE
2021-03-24,France,Ukraine,1,1,FIFA World Cup qualification,Paris,France,FALSE
2021-03-24,Finland,Bosnia and Herzegovina,2,2,FIFA World Cup qualification,Helsinki,Finland,FALSE
2021-03-24,Belgium,Wales,3,1,FIFA World Cup qualification,Leuven,Belgium,FALSE
2021-03-24,Estonia,Czech Republic,2,6,FIFA World Cup qualification,Lublin,Poland,TRUE
2021-03-24,Turkey,Netherlands,4,2,FIFA World Cup qualification,Istanbul,Turkey,FALSE
2021-03-24,Gibraltar,Norway,0,3,FIFA World Cup qualification,Gibraltar,Gibraltar,FALSE
2021-03-24,Latvia,Montenegro,1,2,FIFA World Cup qualification,Riga,Latvia,FALSE
2021-03-24,Malta,Russia,1,3,FIFA World Cup qualification,Ta'Qali,Malta,FALSE
2021-03-24,Slovenia,Croatia,1,0,FIFA World Cup qualification,Ljubljana,Slovenia,FALSE
2021-03-24,Cyprus,Slovakia,0,0,FIFA World Cup qualification,Nicosia,Cyprus,FALSE
2021-03-24,Chad,Namibia,0,3,African Cup of Nations qualification,N'Djamena,Chad,FALSE
2021-03-24,Guinea,Mali,1,0,African Cup of Nations qualification,Clermont-Ferrand,France,TRUE
2021-03-24,South Sudan,Malawi,0,1,African Cup of Nations qualification,Omdurman,Sudan,TRUE
2021-03-24,Uganda,Burkina Faso,0,0,African Cup of Nations qualification,Kampala,Uganda,FALSE
2021-03-24,São Tomé and Príncipe,Sudan,0,2,African Cup of Nations qualification,Sao Tomé,São Tomé and Príncipe,FALSE
2021-03-24,Rwanda,Mozambique,1,0,African Cup of Nations qualification,Kigali,Rwanda,FALSE
2021-03-24,Ethiopia,Madagascar,4,0,African Cup of Nations qualification,Bahir Dar,Ethiopia,FALSE
2021-03-25,Bahrain,Syria,3,1,Friendly,Isa Town,Bahrain,FALSE
2021-03-25,India,Oman,1,1,Friendly,Dubai,United Arab Emirates,TRUE
2021-03-25,Japan,South Korea,3,0,Friendly,Yokohama,Japan,FALSE
2021-03-25,Saudi Arabia,Kuwait,1,0,Friendly,Riyadh,Saudi Arabia,FALSE
2021-03-25,United States,Jamaica,4,1,Friendly,Wiener Neustadt,Austria,TRUE
2021-03-25,El Salvador,Grenada,2,0,FIFA World Cup qualification,San Salvador,El Salvador,FALSE
2021-03-25,Canada,Bermuda,5,1,FIFA World Cup qualification,Orlando,United States,TRUE
2021-03-25,Curaçao,Saint Vincent and the Grenadines,5,0,FIFA World Cup qualification,Willemstad,Curaçao,FALSE
2021-03-25,Panama,Barbados,1,0,FIFA World Cup qualification,Santo Domingo,Dominican Republic,TRUE
2021-03-25,Haiti,Belize,2,0,FIFA World Cup qualification,Port au Prince,Haiti,FALSE
2021-03-25,Trinidad and Tobago,Guyana,3,0,FIFA World Cup qualification,San Cristóbal,Dominican Republic,TRUE
2021-03-25,Spain,Greece,1,1,FIFA World Cup qualification,Granada,Spain,FALSE
2021-03-25,Sweden,Georgia,1,0,FIFA World Cup qualification,Stockholm,Sweden,FALSE
2021-03-25,Bulgaria,Switzerland,1,3,FIFA World Cup qualification,Sofia,Bulgaria,FALSE
2021-03-25,Italy,Northern Ireland,2,0,FIFA World Cup qualification,Parma,Italy,FALSE
2021-03-25,Israel,Denmark,0,2,FIFA World Cup qualification,Tel Aviv,Israel,FALSE
2021-03-25,Scotland,Austria,2,2,FIFA World Cup qualification,Glasgow,Scotland,FALSE
2021-03-25,Moldova,Faroe Islands,1,1,FIFA World Cup qualification,Chișinău,Moldova,FALSE
2021-03-25,England,San Marino,5,0,FIFA World Cup qualification,London,England,FALSE
2021-03-25,Andorra,Albania,0,1,FIFA World Cup qualification,Andorra la Vella,Andorra,FALSE
2021-03-25,Hungary,Poland,3,3,FIFA World Cup qualification,Budapest,Hungary,FALSE
2021-03-25,Germany,Iceland,3,0,FIFA World Cup qualification,Duisburg,Germany,FALSE
2021-03-25,Liechtenstein,Armenia,0,1,FIFA World Cup qualification,Vaduz,Liechtenstein,FALSE
2021-03-25,Romania,North Macedonia,3,2,FIFA World Cup qualification,Bucharest,Romania,FALSE
2021-03-25,South Africa,Ghana,1,1,African Cup of Nations qualification,Johannesburg,South Africa,FALSE
2021-03-25,Gambia,Angola,1,0,African Cup of Nations qualification,Bakau,Gambia,FALSE
2021-03-25,Gabon,DR Congo,3,0,African Cup of Nations qualification,Franceville,Gabon,FALSE
2021-03-25,Comoros,Togo,0,0,African Cup of Nations qualification,Moroni,Comoros,FALSE
2021-03-25,Kenya,Egypt,1,1,African Cup of Nations qualification,Nairobi,Kenya,FALSE
2021-03-25,Botswana,Zimbabwe,0,1,African Cup of Nations qualification,Francistown,Botswana,FALSE
2021-03-25,Zambia,Algeria,3,3,African Cup of Nations qualification,Lusaka,Zambia,FALSE
2021-03-25,Equatorial Guinea,Tanzania,1,0,African Cup of Nations qualification,Malabo,Equatorial Guinea,FALSE
2021-03-25,Libya,Tunisia,2,5,African Cup of Nations qualification,Benina,Libya,FALSE
2021-03-26,Chile,Bolivia,2,1,Friendly,Rancagua,Chile,FALSE
2021-03-26,Burundi,Central African Republic,2,2,African Cup of Nations qualification,Bujumbura,Burundi,FALSE
2021-03-26,Mauritania,Morocco,0,0,African Cup of Nations qualification,Nouakchott,Mauritania,FALSE
2021-03-26,Cape Verde,Cameroon,3,1,African Cup of Nations qualification,Praia,Cape Verde,FALSE
2021-03-26,Eswatini,Guinea-Bissau,1,3,African Cup of Nations qualification,Manzini,Eswatini,FALSE
2021-03-26,Congo,Senegal,0,0,African Cup of Nations qualification,Brazzaville,Congo,FALSE
2021-03-26,Niger,Ivory Coast,0,3,African Cup of Nations qualification,Lomé,Togo,TRUE
2021-03-27,Bosnia and Herzegovina,Costa Rica,0,0,Friendly,Zenica,Bosnia and Herzegovina,FALSE
2021-03-27,Nepal,Bangladesh,0,0,Friendly,Kathmandu,Nepal,FALSE
2021-03-27,Qatar,Azerbaijan,2,1,Friendly,Debrecen,Hungary,TRUE
2021-03-27,Wales,Mexico,1,0,Friendly,Cardiff,Wales,FALSE
2021-03-27,U.S. Virgin Islands,Antigua and Barbuda,0,3,FIFA World Cup qualification,St Croix,U.S. Virgin Islands,FALSE
2021-03-27,Aruba,Suriname,0,6,FIFA World Cup qualification,Bradenton,United States,TRUE
2021-03-27,British Virgin Islands,Guatemala,0,3,FIFA World Cup qualification,Willemstad,Curaçao,TRUE
2021-03-27,Anguilla,Dominican Republic,0,6,FIFA World Cup qualification,Fort Lauderdale,United States,TRUE
2021-03-27,Turks and Caicos Islands,Nicaragua,0,7,FIFA World Cup qualification,San Cristóbal,Dominican Republic,TRUE
2021-03-27,Bahamas,Saint Kitts and Nevis,0,4,FIFA World Cup qualification,Nassau,Bahamas,FALSE
2021-03-27,Republic of Ireland,Luxembourg,0,1,FIFA World Cup qualification,Dublin,Republic of Ireland,FALSE
2021-03-27,Serbia,Portugal,2,2,FIFA World Cup qualification,Belgrade,Serbia,FALSE
2021-03-27,Belarus,Estonia,4,2,FIFA World Cup qualification,Minsk,Belarus,FALSE
2021-03-27,Czech Republic,Belgium,1,1,FIFA World Cup qualification,Prague,Czech Republic,FALSE
2021-03-27,Montenegro,Gibraltar,4,1,FIFA World Cup qualification,Podgorica,Montenegro,FALSE
2021-03-27,Netherlands,Latvia,2,0,FIFA World Cup qualification,Amsterdam,Netherlands,FALSE
2021-03-27,Norway,Turkey,0,3,FIFA World Cup qualification,Malaga,Spain,TRUE
2021-03-27,Russia,Slovenia,2,1,FIFA World Cup qualification,Sochi,Russia,FALSE
2021-03-27,Croatia,Cyprus,1,0,FIFA World Cup qualification,Rijeka,Croatia,FALSE
2021-03-27,Slovakia,Malta,2,2,FIFA World Cup qualification,Trnava,Slovakia,FALSE
2021-03-27,Lesotho,Sierra Leone,0,0,African Cup of Nations qualification,Maseru,Lesotho,FALSE
2021-03-27,Benin,Nigeria,0,1,African Cup of Nations qualification,Porto Novo,Benin,FALSE
2021-03-28,Greece,Honduras,2,1,Friendly,Thessaloniki,Greece,FALSE
2021-03-28,Northern Ireland,United States,1,2,Friendly,Belfast,Northern Ireland,FALSE
2021-03-28,Montserrat,El Salvador,1,1,FIFA World Cup qualification,Willemstad,Curaçao,TRUE
2021-03-28,Cuba,Curaçao,1,2,FIFA World Cup qualification,Guatemala City,Guatemala,TRUE
2021-03-28,Dominica,Panama,1,2,FIFA World Cup qualification,Santo Domingo,Dominican Republic,TRUE
2021-03-28,Puerto Rico,Trinidad and Tobago,1,1,FIFA World Cup qualification,Mayagüez,Puerto Rico,FALSE
2021-03-28,Georgia,Spain,1,2,FIFA World Cup qualification,Tbilisi,Georgia,FALSE
2021-03-28,Kosovo,Sweden,0,3,FIFA World Cup qualification,Pristina,Kosovo,FALSE
2021-03-28,Switzerland,Lithuania,1,0,FIFA World Cup qualification,St Gallen,Switzerland,FALSE
2021-03-28,Bulgaria,Italy,0,2,FIFA World Cup qualification,Sofia,Bulgaria,FALSE
2021-03-28,Kazakhstan,France,0,2,FIFA World Cup qualification,Nur-Sultan,Kazakhstan,FALSE
2021-03-28,Ukraine,Finland,1,1,FIFA World Cup qualification,Kiev,Ukraine,FALSE
2021-03-28,Denmark,Moldova,8,0,FIFA World Cup qualification,Herning,Denmark,FALSE
2021-03-28,Austria,Faroe Islands,3,1,FIFA World Cup qualification,Vienna,Austria,FALSE
2021-03-28,Israel,Scotland,1,1,FIFA World Cup qualification,Tel Aviv,Israel,FALSE
2021-03-28,Albania,England,0,2,FIFA World Cup qualification,Tirana,Albania,FALSE
2021-03-28,Poland,Andorra,3,0,FIFA World Cup qualification,Warsaw,Poland,FALSE
2021-03-28,San Marino,Hungary,0,3,FIFA World Cup qualification,Serravalle,San Marino,FALSE
2021-03-28,Armenia,Iceland,2,0,FIFA World Cup qualification,Yerevan,Armenia,FALSE
2021-03-28,North Macedonia,Liechtenstein,5,0,FIFA World Cup qualification,Skopje,North Macedonia,FALSE
2021-03-28,Romania,Germany,0,1,FIFA World Cup qualification,Bucharest,Romania,FALSE
2021-03-28,Namibia,Guinea,2,1,African Cup of Nations qualification,Windhoek,Namibia,FALSE
2021-03-28,Mali,Chad,3,0,African Cup of Nations qualification,Bamako,Mali,FALSE
2021-03-28,Ghana,São Tomé and Príncipe,3,1,African Cup of Nations qualification,Cape Coast,Ghana,FALSE
2021-03-28,Sudan,South Africa,2,0,African Cup of Nations qualification,Omdurman,Sudan,FALSE
2021-03-28,Tunisia,Equatorial Guinea,2,1,African Cup of Nations qualification,Radès,Tunisia,FALSE
2021-03-28,Tanzania,Libya,1,0,African Cup of Nations qualification,Dar es Salaam,Tanzania,FALSE
2021-03-29,Ecuador,Bolivia,2,1,Friendly,Guayaquil,Ecuador,FALSE
2021-03-29,India,United Arab Emirates,0,6,Friendly,Dubai,United Arab Emirates,TRUE
2021-03-29,Kuwait,Lebanon,1,1,Friendly,Dubai,United Arab Emirates,TRUE
2021-03-29,Nepal,Bangladesh,2,1,Friendly,Kathmandu,Nepal,FALSE
2021-03-29,Uzbekistan,Iraq,0,1,Friendly,Tashkent,Uzbekistan,FALSE
2021-03-29,Cayman Islands,Canada,0,11,FIFA World Cup qualification,Bradenton,United States,TRUE
2021-03-29,Burkina Faso,South Sudan,1,0,African Cup of Nations qualification,Ouagadougou,Burkina Faso,FALSE
2021-03-29,Malawi,Uganda,1,0,African Cup of Nations qualification,Lilongwe,Malawi,FALSE
2021-03-29,Angola,Gabon,2,0,African Cup of Nations qualification,Luanda,Angola,FALSE
2021-03-29,DR Congo,Gambia,1,0,African Cup of Nations qualification,Kinshasa,DR Congo,TRUE
2021-03-29,Togo,Kenya,1,2,African Cup of Nations qualification,Lomé,Togo,FALSE
2021-03-29,Egypt,Comoros,4,0,African Cup of Nations qualification,Cairo,Egypt,FALSE
2021-03-29,Algeria,Botswana,5,0,African Cup of Nations qualification,Algiers,Algeria,FALSE
2021-03-29,Zimbabwe,Zambia,0,2,African Cup of Nations qualification,Harare,Zimbabwe,FALSE
2021-03-30,Bahrain,Jordan,1,2,Friendly,Riffa,Bahrain,FALSE
2021-03-30,Costa Rica,Mexico,0,1,Friendly,Wiener Neustadt,Austria,TRUE
2021-03-30,Iran,Syria,3,0,Friendly,Tehran,Iran,FALSE
2021-03-30,Republic of Ireland,Qatar,1,1,Friendly,Debrecen,Hungary,TRUE
2021-03-30,Grenada,U.S. Virgin Islands,1,0,FIFA World Cup qualification,St George's,Grenada,FALSE
2021-03-30,Bermuda,Aruba,5,0,FIFA World Cup qualification,Bradenton,United States,TRUE
2021-03-30,Saint Vincent and the Grenadines,British Virgin Islands,3,0,FIFA World Cup qualification,Willemstad,Curaçao,TRUE
2021-03-30,Barbados,Anguilla,1,0,FIFA World Cup qualification,Santo Domingo,Dominican Republic,TRUE
2021-03-30,Belize,Turks and Caicos Islands,5,0,FIFA World Cup qualification,San Cristóbal,Dominican Republic,TRUE
2021-03-30,Guyana,Bahamas,4,0,FIFA World Cup qualification,Santo Domingo,Dominican Republic,TRUE
2021-03-30,Azerbaijan,Serbia,1,2,FIFA World Cup qualification,Baku,Azerbaijan,FALSE
2021-03-30,Luxembourg,Portugal,1,3,FIFA World Cup qualification,Luxembourg City,Luxembourg,FALSE
2021-03-30,Wales,Czech Republic,1,0,FIFA World Cup qualification,Cardiff,Wales,FALSE
2021-03-30,Belgium,Belarus,8,0,FIFA World Cup qualification,Leuven,Belgium,FALSE
2021-03-30,Gibraltar,Netherlands,0,7,FIFA World Cup qualification,Gibraltar,Gibraltar,FALSE
2021-03-30,Montenegro,Norway,0,1,FIFA World Cup qualification,Podgorica,Montenegro,FALSE
2021-03-30,Turkey,Latvia,3,3,FIFA World Cup qualification,Istanbul,Turkey,FALSE
2021-03-30,Cyprus,Slovenia,1,0,FIFA World Cup qualification,Nicosia,Cyprus,FALSE
2021-03-30,Croatia,Malta,3,0,FIFA World Cup qualification,Rijeka,Croatia,FALSE
2021-03-30,Slovakia,Russia,2,1,FIFA World Cup qualification,Trnava,Slovakia,FALSE
2021-03-30,Saudi Arabia,Palestine,5,0,FIFA World Cup qualification,Riyadh,Saudi Arabia,FALSE
2021-03-30,Japan,Mongolia,14,0,FIFA World Cup qualification,Chiba,Japan,FALSE
2021-03-30,Tajikistan,Mongolia,3,0,FIFA World Cup qualification,Dushanbe,Tajikistan,FALSE
2021-03-30,Central African Republic,Mauritania,0,1,African Cup of Nations qualification,Bangui,Central African Republic,FALSE
2021-03-30,Morocco,Burundi,1,0,African Cup of Nations qualification,Rabat,Morocco,FALSE
2021-03-30,Cameroon,Rwanda,0,0,African Cup of Nations qualification,Douala,Cameroon,FALSE
2021-03-30,Mozambique,Cape Verde,0,1,African Cup of Nations qualification,Maputo,Mozambique,FALSE
2021-03-30,Guinea-Bissau,Congo,3,0,African Cup of Nations qualification,Bissau,Guinea-Bissau,FALSE
2021-03-30,Senegal,Eswatini,1,1,African Cup of Nations qualification,Thiès,Senegal,FALSE
2021-03-30,Ivory Coast,Ethiopia,3,1,African Cup of Nations qualification,Abidjan,Ivory Coast,FALSE
2021-03-30,Madagascar,Niger,0,0,African Cup of Nations qualification,Toamasina,Madagascar,FALSE
2021-03-30,Nigeria,Lesotho,3,0,African Cup of Nations qualification,Lagos,Nigeria,FALSE
2021-03-31,Sweden,Estonia,1,0,Friendly,Stockholm,Sweden,FALSE
2021-03-31,Switzerland,Finland,3,2,Friendly,St Gallen,Switzerland,FALSE
2021-03-31,Spain,Kosovo,3,1,FIFA World Cup qualification,Seville,Spain,FALSE
2021-03-31,Greece,Georgia,1,1,FIFA World Cup qualification,Thessaloniki,Greece,FALSE
2021-03-31,Northern Ireland,Bulgaria,0,0,FIFA World Cup qualification,Belfast,Northern Ireland,FALSE
2021-03-31,Lithuania,Italy,0,2,FIFA World Cup qualification,Vilnius,Lithuania,FALSE
2021-03-31,Bosnia and Herzegovina,France,0,1,FIFA World Cup qualification,Sarajevo,Bosnia and Herzegovina,FALSE
2021-03-31,Ukraine,Kazakhstan,1,1,FIFA World Cup qualification,Kiev,Ukraine,FALSE
2021-03-31,Scotland,Faroe Islands,4,0,FIFA World Cup qualification,Glasgow,Scotland,FALSE
2021-03-31,Austria,Denmark,0,4,FIFA World Cup qualification,Vienna,Austria,FALSE
2021-03-31,Moldova,Israel,1,4,FIFA World Cup qualification,Chișinău,Moldova,FALSE
2021-03-31,England,Poland,2,1,FIFA World Cup qualification,London,England,FALSE
2021-03-31,Andorra,Hungary,1,4,FIFA World Cup qualification,Andorra la Vella,Andorra,FALSE
2021-03-31,San Marino,Albania,0,2,FIFA World Cup qualification,Serravalle,San Marino,FALSE
2021-03-31,Armenia,Romania,3,2,FIFA World Cup qualification,Yerevan,Armenia,FALSE
2021-03-31,Germany,North Macedonia,1,2,FIFA World Cup qualification,Duisburg,Germany,FALSE
2021-03-31,Liechtenstein,Iceland,1,4,FIFA World Cup qualification,Vaduz,Liechtenstein,FALSE

Can't render this file because it is too large.

View File

@ -5,7 +5,7 @@ import kaggle
kaggle.api.authenticate()
kaggle.api.dataset_download_files('martj42/international-football-results-from-1872-to-2017', path='.', unzip=True)
# kaggle.api.dataset_download_files('martj42/international-football-results-from-1872-to-2017', path='.', unzip=True)
results = pd.read_csv('results.csv')

8418
test.csv Normal file

File diff suppressed because it is too large Load Diff

25251
train.csv Normal file

File diff suppressed because it is too large Load Diff

146
training.py Normal file
View File

@ -0,0 +1,146 @@
import sys
import torch
import torch.nn as nn
import pandas as pd
import torch.nn.functional as F
from torch.utils.data import DataLoader, TensorDataset, random_split
from sklearn import preprocessing
batch_size = int(sys.argv[1]) if len(sys.argv) > 1 else 64
epochs = int(sys.argv[2]) if len(sys.argv) > 2 else 100
train = pd.read_csv('train.csv')
test = pd.read_csv('test.csv')
categorical_cols = train.select_dtypes(include=object).columns.values
input_cols = train.columns.values[1:-1]
output_cols = train.columns.values[-1:]
def dataframe_to_arrays(dataframe):
# Make a copy of the original dataframe
dataframe1 = dataframe.copy(deep=True)
# Convert non-numeric categorical columns to numbers
for col in categorical_cols:
dataframe1[col] = dataframe1[col].astype('category').cat.codes
# Extract input & outupts as numpy arrays
min_max_scaler = preprocessing.MinMaxScaler()
x_scaled = min_max_scaler.fit_transform(dataframe1)
dataframe1 = pd.DataFrame(x_scaled, columns = dataframe1.columns)
inputs_array = dataframe1[input_cols].to_numpy()
targets_array = dataframe1[output_cols].to_numpy()
return inputs_array, targets_array
inputs_array_training, targets_array_training = dataframe_to_arrays(train)
inputs_array_testing, targets_array_testing = dataframe_to_arrays(test)
inputs_training = torch.from_numpy(inputs_array_training).type(torch.float32)
targets_training = torch.from_numpy(targets_array_training).type(torch.float32)
inputs_testing = torch.from_numpy(inputs_array_testing).type(torch.float32)
targets_testing = torch.from_numpy(targets_array_testing).type(torch.float32)
train_dataset = TensorDataset(inputs_training, targets_training)
val_dataset = TensorDataset(inputs_testing, targets_testing)
train_loader = DataLoader(train_dataset, batch_size, shuffle=True)
val_loader = DataLoader(val_dataset, batch_size*2)
input_size = len(input_cols)
output_size = len(output_cols)
class FootbalModel(nn.Module):
def __init__(self):
super().__init__()
self.linear = nn.Linear(input_size, output_size)
def forward(self, xb):
out = self.linear(xb)
return out
def training_step(self, batch):
inputs, targets = batch
# Generate predictions
out = self(inputs)
# Calcuate loss
# loss = F.l1_loss(out, targets)
loss = F.mse_loss(out, targets)
return loss
def validation_step(self, batch):
inputs, targets = batch
# Generate predictions
out = self(inputs)
# Calculate loss
# loss = F.l1_loss(out, targets)
loss = F.mse_loss(out, targets)
return {'val_loss': loss.detach()}
def validation_epoch_end(self, outputs):
batch_losses = [x['val_loss'] for x in outputs]
epoch_loss = torch.stack(batch_losses).mean()
return {'val_loss': epoch_loss.item()}
def epoch_end(self, epoch, result, num_epochs):
# Print result every 20th epoch
if (epoch + 1) % 20 == 0 or epoch == num_epochs - 1:
print("Epoch [{}], val_loss: {:.4f}".format(epoch + 1, result['val_loss']))
model = FootbalModel()
list(model.parameters())
def evaluate(model, val_loader):
outputs = [model.validation_step(batch) for batch in val_loader]
return model.validation_epoch_end(outputs)
def fit(epochs, lr, model, train_loader, val_loader, opt_func=torch.optim.SGD):
history = []
optimizer = opt_func(model.parameters(), lr)
for epoch in range(epochs):
# Training Phase
for batch in train_loader:
loss = model.training_step(batch)
loss.backward()
optimizer.step()
optimizer.zero_grad()
# Validation phase
result = evaluate(model, val_loader)
model.epoch_end(epoch, result, epochs)
history.append(result)
return history
result = evaluate(model, val_loader) # Use the the evaluate function
# epochs = 100
lr = 1e-6
history3 = fit(epochs, lr, model, train_loader, val_loader)
def predict_single(input, target, model):
inputs = input.unsqueeze(0)
predictions = model(input) # fill this
prediction = predictions[0].detach()
print("Prediction:", prediction)
if prediction >= 0.5:
print('Neutral')
else:
print('not neutral')
for i in range(len(val_dataset)):
input, target = val_dataset[i]
predict_single(input, target, model)
torch.save(model.state_dict(), 'FootballModel.pth')

8418
valid.csv Normal file

File diff suppressed because it is too large Load Diff