forked from Kaggle/docker-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request Kaggle#537 from Kaggle/update-pdpbox
Use newest version of pdpbox (fixes bug on contour_label_font)
- Loading branch information
Showing
3 changed files
with
156 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
Date,Team,Opponent,Goal Scored,Ball Possession %,Attempts,On-Target,Off-Target,Blocked,Corners,Offsides,Free Kicks,Saves,Pass Accuracy %,Passes,Distance Covered (Kms),Fouls Committed,Yellow Card,Yellow & Red,Red,Man of the Match,1st Goal,Round,PSO,Goals in PSO,Own goals,Own goal Time | ||
14-06-2018,Russia,Saudi Arabia,5,40,13,7,3,3,6,3,11,0,78,306,118,22,0,0,0,Yes,12,Group Stage,No,0,, | ||
14-06-2018,Saudi Arabia,Russia,0,60,6,0,3,3,2,1,25,2,86,511,105,10,0,0,0,No,,Group Stage,No,0,, | ||
15-06-2018,Egypt,Uruguay,0,43,8,3,3,2,0,1,7,3,78,395,112,12,2,0,0,No,,Group Stage,No,0,, | ||
15-06-2018,Uruguay,Egypt,1,57,14,4,6,4,5,1,13,3,86,589,111,6,0,0,0,Yes,89,Group Stage,No,0,, | ||
15-06-2018,Morocco,Iran,0,64,13,3,6,4,5,0,14,2,86,433,101,22,1,0,0,No,,Group Stage,No,0,1,90 | ||
15-06-2018,Iran,Morocco,1,36,8,2,5,1,2,0,22,2,86,194,100,14,3,0,0,Yes,90,Group Stage,No,0,, | ||
15-06-2018,Portugal,Spain,3,39,8,3,2,3,4,1,13,2,87,366,102,12,1,0,0,No,4,Group Stage,No,0,, | ||
15-06-2018,Spain,Portugal,3,61,12,5,5,2,5,3,13,0,93,727,103,10,1,0,0,Yes,24,Group Stage,No,0,, | ||
16-06-2018,France,Australia,2,51,12,5,4,3,5,0,19,1,87,484,103,16,1,0,0,Yes,58,Group Stage,No,0,, | ||
16-06-2018,Australia,France,1,49,4,1,2,1,1,0,16,4,85,390,111,19,3,0,0,No,62,Group Stage,No,0,1,81 | ||
16-06-2018,Argentina,Iceland,1,72,26,7,9,10,10,0,15,2,92,718,101,10,0,0,0,No,19,Group Stage,No,0,, | ||
16-06-2018,Iceland,Argentina,1,28,9,3,5,1,2,0,10,7,67,189,105,15,0,0,0,Yes,23,Group Stage,No,0,, | ||
16-06-2018,Peru,Denmark,0,52,18,6,7,5,3,5,21,2,85,394,104,10,1,0,0,No,,Group Stage,No,0,, | ||
16-06-2018,Denmark,Peru,1,48,10,3,5,2,7,3,15,6,82,342,110,18,2,0,0,Yes,59,Group Stage,No,0,, | ||
17-06-2018,Croatia,Nigeria,2,54,11,2,7,2,6,2,17,2,84,462,104,20,2,0,0,Yes,32,Group Stage,No,0,, | ||
17-06-2018,Nigeria,Croatia,0,46,14,2,5,7,5,1,22,1,84,388,101,16,1,0,0,No,,Group Stage,No,0,1,32 | ||
17-06-2018,Costa Rica,Serbia,0,50,10,3,3,4,5,1,18,2,83,428,107,18,2,0,0,No,,Group Stage,No,0,, | ||
17-06-2018,Serbia,Costa Rica,1,50,10,3,5,2,4,3,19,3,83,392,109,15,2,0,0,Yes,56,Group Stage,No,0,, | ||
17-06-2018,Germany,Mexico,0,60,25,9,9,7,8,1,17,3,88,595,110,10,2,0,0,Yes,,Group Stage,No,0,, | ||
17-06-2018,Mexico,Germany,1,40,12,4,6,2,1,2,11,9,82,281,106,15,2,0,0,No,35,Group Stage,No,0,, | ||
17-06-2018,Brazil,Switzerland,1,52,20,4,9,7,7,1,19,1,88,521,103,12,1,0,0,Yes,20,Group Stage,No,0,, | ||
17-06-2018,Switzerland,Brazil,1,48,6,2,4,0,2,0,13,3,83,436,108,19,3,0,0,No,50,Group Stage,No,0,, | ||
18-06-2018,Sweden,Korea Republic,1,52,15,4,5,6,6,1,23,0,84,417,102,20,1,0,0,Yes,65,Group Stage,No,0,, | ||
18-06-2018,Korea Republic,Sweden,0,48,5,0,2,3,5,0,21,3,79,351,103,23,2,0,0,No,,Group Stage,No,0,, | ||
18-06-2018,Belgium,Panama,3,61,15,6,7,2,9,1,21,2,89,544,102,17,3,0,0,Yes,47,Group Stage,No,0,, | ||
18-06-2018,Panama,Belgium,0,39,6,2,4,0,3,3,18,2,82,317,100,18,5,0,0,No,,Group Stage,No,0,, | ||
18-06-2018,Tunisia,England,1,41,6,1,3,2,2,2,11,5,82,326,103,14,0,0,0,No,11,Group Stage,No,0,, | ||
18-06-2018,England,Tunisia,2,59,17,7,7,3,7,3,16,0,91,492,105,8,1,0,0,Yes,35,Group Stage,No,0,, | ||
19-06-2018,Colombia,Japan,1,41,8,3,1,4,3,2,10,4,82,352,93,15,2,0,1,No,39,Group Stage,No,0,, | ||
19-06-2018,Japan,Colombia,2,59,14,6,5,3,6,1,17,2,87,565,101,9,1,0,0,Yes,6,Group Stage,No,0,, | ||
19-06-2018,Poland,Senegal,1,57,10,4,5,1,3,3,18,1,88,552,110,8,1,0,0,No,37,Group Stage,No,0,1,37 | ||
19-06-2018,Senegal,Poland,2,43,8,2,4,2,3,3,11,3,81,328,107,15,2,0,0,Yes,60,Group Stage,No,0,, | ||
19-06-2018,Russia,Egypt,3,47,11,3,5,3,7,0,10,0,76,380,115,11,1,0,0,Yes,59,Group Stage,No,0,, | ||
19-06-2018,Egypt,Russia,1,53,13,1,8,4,4,0,11,1,81,438,110,10,1,0,0,No,47,Group Stage,No,0,1,47 | ||
20-06-2018,Portugal,Morocco,1,47,10,2,4,4,5,1,24,4,76,387,105,19,1,0,0,Yes,4,Group Stage,No,0,, | ||
20-06-2018,Morocco,Portugal,0,53,16,4,10,2,7,1,20,1,77,466,107,23,1,0,0,No,,Group Stage,No,0,, | ||
20-06-2018,Uruguay,Saudi Arabia,1,47,13,4,6,3,3,1,15,3,88,521,101,10,0,0,0,Yes,23,Group Stage,No,0,, | ||
20-06-2018,Saudi Arabia,Uruguay,0,53,8,3,3,2,4,2,11,3,86,590,100,13,0,0,0,No,,Group Stage,No,0,, | ||
20-06-2018,Iran,Spain,0,30,5,0,5,0,2,2,15,2,69,219,106,14,2,0,0,No,,Group Stage,No,0,, | ||
20-06-2018,Spain,Iran,1,70,17,3,6,8,6,1,16,0,89,805,105,14,0,0,0,Yes,54,Group Stage,No,0,, | ||
21-06-2018,Denmark,Australia,1,49,10,5,5,0,3,1,5,4,88,458,112,7,2,0,0,Yes,7,Group Stage,No,0,, | ||
21-06-2018,Australia,Denmark,1,51,14,5,5,4,5,0,8,5,85,520,114,5,0,0,0,No,38,Group Stage,No,0,, | ||
21-06-2018,France,Peru,1,44,12,4,6,2,5,0,16,2,77,405,103,11,2,0,0,Yes,34,Group Stage,No,0,, | ||
21-06-2018,Peru,France,0,56,10,2,6,2,3,1,11,3,81,532,102,15,2,0,0,No,,Group Stage,No,0,, | ||
21-06-2018,Argentina,Croatia,0,58,10,3,3,4,5,3,26,2,81,505,101,15,3,0,0,No,,Group Stage,No,0,, | ||
21-06-2018,Croatia,Argentina,3,42,15,5,6,4,2,3,18,3,80,372,104,23,4,0,0,Yes,53,Group Stage,No,0,, | ||
22-06-2018,Brazil,Costa Rica,2,66,23,9,9,5,10,3,14,0,90,732,105,11,2,0,0,Yes,90,Group Stage,No,0,, | ||
22-06-2018,Costa Rica,Brazil,0,34,4,0,4,0,1,3,14,7,73,271,109,11,1,0,0,No,,Group Stage,No,0,, | ||
22-06-2018,Nigeria,Iceland,2,58,16,4,6,6,6,1,10,3,84,473,100,9,1,0,0,Yes,49,Group Stage,No,0,, | ||
22-06-2018,Iceland,Nigeria,0,42,10,3,6,1,5,0,10,2,75,291,106,10,0,0,0,No,,Group Stage,No,0,, | ||
22-06-2018,Serbia,Switzerland,1,42,12,3,7,2,3,0,15,3,78,309,116,17,4,0,0,No,5,Group Stage,No,0,, | ||
22-06-2018,Switzerland,Serbia,2,58,20,5,8,7,7,3,17,2,87,547,112,12,1,0,0,Yes,52,Group Stage,No,0,, | ||
23-06-2018,Belgium,Tunisia,5,52,23,12,8,3,5,3,16,3,84,468,104,12,0,0,0,Yes,6,Group Stage,No,0,, | ||
23-06-2018,Tunisia,Belgium,2,48,15,5,6,4,2,3,15,6,82,477,102,13,1,0,0,No,18,Group Stage,No,0,, | ||
23-06-2018,Korea Republic,Mexico,1,41,17,6,2,9,7,0,7,3,82,346,99,24,4,0,0,No,90,Group Stage,No,0,, | ||
23-06-2018,Mexico,Korea Republic,2,59,13,5,6,2,5,0,24,5,89,485,97,7,0,0,0,Yes,26,Group Stage,No,0,, | ||
23-06-2018,Germany,Sweden,2,71,16,5,4,7,8,5,15,5,91,699,111,12,0,1,0,Yes,48,Group Stage,No,0,, | ||
23-06-2018,Sweden,Germany,1,29,8,6,1,1,3,2,17,4,77,213,110,13,2,0,0,No,32,Group Stage,No,0,, | ||
24-06-2018,England,Panama,6,58,12,7,3,2,3,3,13,1,94,593,99,14,1,0,0,Yes,8,Group Stage,No,0,, | ||
24-06-2018,Panama,England,1,42,8,2,5,1,2,0,17,1,88,398,89,13,3,0,0,No,78,Group Stage,No,0,, | ||
24-06-2018,Japan,Senegal,2,54,7,3,2,2,2,2,18,5,84,449,105,8,2,0,0,No,34,Group Stage,No,0,, | ||
24-06-2018,Senegal,Japan,2,46,14,7,5,2,5,4,10,1,79,338,102,14,3,0,0,Yes,11,Group Stage,No,0,, | ||
24-06-2018,Poland,Colombia,0,45,9,2,3,4,7,1,11,0,79,424,107,15,2,0,0,No,,Group Stage,No,0,, | ||
24-06-2018,Colombia,Poland,3,55,13,3,5,5,5,1,16,2,82,514,108,10,0,0,0,Yes,40,Group Stage,No,0,, | ||
25-06-2018,Uruguay,Russia,3,56,17,7,6,4,4,0,20,1,88,492,101,17,1,0,0,Yes,10,Group Stage,No,0,, | ||
25-06-2018,Russia,Uruguay,0,44,3,1,1,1,2,2,17,5,83,355,98,18,1,1,0,No,,Group Stage,No,0,1,23 | ||
25-06-2018,Saudi Arabia,Egypt,2,61,22,7,10,5,7,1,19,0,90,655,101,7,0,0,0,No,45,Group Stage,No,0,, | ||
25-06-2018,Egypt,Saudi Arabia,1,39,8,1,6,1,2,3,8,5,82,357,106,16,2,0,0,Yes,22,Group Stage,No,0,, | ||
25-06-2018,Spain,Morocco,2,68,16,4,11,1,7,1,18,1,91,762,103,5,0,0,0,Yes,19,Group Stage,No,0,, | ||
25-06-2018,Morocco,Spain,2,32,6,3,2,1,1,1,6,1,84,247,111,17,6,0,0,No,14,Group Stage,No,0,, | ||
25-06-2018,Iran,Portugal,1,32,8,2,5,1,1,1,12,3,69,226,93,16,2,0,0,No,90,Group Stage,No,0,, | ||
25-06-2018,Portugal,Iran,1,68,14,4,7,3,5,1,17,1,89,619,89,11,4,0,0,Yes,45,Group Stage,No,0,, | ||
26-06-2018,Denmark,France,0,38,5,1,2,2,4,1,11,4,72,305,106,10,1,0,0,No,,Group Stage,No,0,, | ||
26-06-2018,France,Denmark,0,62,11,4,6,1,2,1,11,1,87,669,104,10,0,0,0,Yes,,Group Stage,No,0,, | ||
26-06-2018,Australia,Peru,0,53,14,2,7,5,8,3,13,1,86,555,105,13,4,0,0,No,,Group Stage,No,0,, | ||
26-06-2018,Peru,Australia,2,47,4,3,1,0,3,1,16,2,81,418,100,12,2,0,0,Yes,18,Group Stage,No,0,, | ||
26-06-2018,Nigeria,Argentina,1,34,9,3,5,1,3,0,17,2,76,244,98,20,2,0,0,No,51,Group Stage,No,0,, | ||
26-06-2018,Argentina,Nigeria,2,66,8,4,3,1,5,2,20,2,84,565,101,15,3,0,0,Yes,14,Group Stage,No,0,, | ||
26-06-2018,Iceland,Croatia,1,41,17,6,8,3,10,1,12,0,73,324,103,10,3,0,0,Yes,76,Group Stage,No,0,, | ||
26-06-2018,Croatia,Iceland,2,59,13,2,8,3,5,0,11,5,87,524,101,12,2,0,0,No,53,Group Stage,No,0,, | ||
27-06-2018,Korea Republic,Germany,2,30,11,5,5,1,3,0,8,7,74,237,118,16,4,0,0,Yes,90,Group Stage,No,0,, | ||
27-06-2018,Germany,Korea Republic,0,70,26,6,11,9,9,1,16,3,88,719,115,7,0,0,0,No,,Group Stage,No,0,, | ||
27-06-2018,Mexico,Sweden,0,65,19,3,8,8,7,2,11,3,83,487,95,14,3,0,0,No,,Group Stage,No,0,1,74 | ||
27-06-2018,Sweden,Mexico,3,35,13,5,7,1,3,0,16,3,67,212,102,11,2,0,0,Yes,50,Group Stage,No,0,, | ||
27-06-2018,Serbia,Brazil,0,44,10,1,5,4,5,2,11,4,78,467,114,13,3,0,0,No,,Group Stage,No,0,, | ||
27-06-2018,Brazil,Serbia,2,56,13,6,3,4,9,4,15,1,88,631,105,7,0,0,0,Yes,36,Group Stage,No,0,, | ||
27-06-2018,Switzerland,Costa Rica,2,60,12,3,5,4,6,1,15,5,87,594,103,9,3,0,0,Yes,31,Group Stage,No,0,1,90 | ||
27-06-2018,Costa Rica,Switzerland,2,40,14,6,6,2,5,1,10,1,82,348,103,14,3,0,0,No,56,Group Stage,No,0,, | ||
28-06-2018,Japan,Poland,0,54,10,3,4,3,5,1,8,2,86,557,83,11,1,0,0,No,,Group Stage,No,0,, | ||
28-06-2018,Poland,Japan,1,46,11,2,5,4,7,0,12,3,83,462,80,8,0,0,0,Yes,59,Group Stage,No,0,, | ||
28-06-2018,Senegal,Colombia,0,43,8,3,4,1,1,3,18,1,78,281,97,15,1,0,0,No,,Group Stage,No,0,, | ||
28-06-2018,Colombia,Senegal,1,57,4,2,1,1,3,3,18,3,83,431,100,15,1,0,0,Yes,74,Group Stage,No,0,, | ||
28-06-2018,Panama,Tunisia,1,36,9,4,4,1,0,4,20,5,77,284,102,18,3,0,0,No,33,Group Stage,No,0,, | ||
28-06-2018,Tunisia,Panama,2,64,15,7,4,4,6,1,22,4,87,626,107,19,3,0,0,Yes,51,Group Stage,No,0,1,33 | ||
28-06-2018,England,Belgium,0,48,13,1,7,5,7,3,15,3,88,484,109,11,0,0,0,No,,Group Stage,No,0,, | ||
28-06-2018,Belgium,England,1,52,15,4,4,7,2,1,14,1,88,556,106,14,2,0,0,Yes,51,Group Stage,No,0,, | ||
30-06-2018,France,Argentina,4,41,9,4,4,1,0,0,16,1,84,351,97,21,3,0,0,Yes,13,Round of 16,No,0,, | ||
30-06-2018,Argentina,France,3,59,9,4,1,4,4,1,21,0,86,547,96,15,5,0,0,No,41,Round of 16,No,0,, | ||
30-06-2018,Uruguay,Portugal,2,39,6,3,2,1,2,0,14,4,69,269,106,13,0,0,0,Yes,7,Round of 16,No,0,, | ||
30-06-2018,Portugal,Uruguay,1,61,20,5,1,8,10,1,13,1,84,583,107,13,1,0,0,No,55,Round of 16,No,0,, | ||
01-07-2018,Spain,Russia,1,75,25,9,6,10,6,1,20,0,91,1137,137,5,1,0,0,No,12,Round of 16,Yes,3,, | ||
01-07-2018,Russia,Spain,1,25,6,1,3,2,5,1,6,9,72,284,146,19,2,0,0,Yes,41,Round of 16,Yes,4,1,12 | ||
01-07-2018,Croatia,Denmark,1,54,22,7,8,7,5,2,19,2,81,626,132,5,0,0,0,Yes,4,Round of 16,Yes,3,, | ||
01-07-2018,Denmark,Croatia,1,46,15,3,10,2,4,0,7,7,79,539,135,19,1,0,0,No,1,Round of 16,Yes,2,, | ||
02-07-2018,Brazil,Mexico,2,47,21,10,7,4,8,0,20,1,83,398,92,6,2,0,0,Yes,51,Round of 16,No,0,, | ||
02-07-2018,Mexico,Brazil,0,53,13,1,4,8,7,2,6,8,85,424,89,18,4,0,0,No,,Round of 16,No,0,, | ||
02-07-2018,Belgium,Japan,3,56,24,8,10,6,10,1,10,3,87,621,108,13,0,0,0,Yes,69,Round of 16,No,0,, | ||
02-07-2018,Japan,Belgium,2,44,11,4,4,3,6,1,14,5,83,453,109,9,1,0,0,No,48,Round of 16,No,0,, | ||
03-07-2018,Sweden,Switzerland,1,37,12,3,6,3,3,1,13,4,73,271,105,11,1,0,0,Yes,66,Round of 16,No,0,, | ||
03-07-2018,Switzerland,Sweden,0,63,18,4,5,9,11,0,12,2,84,599,103,13,2,0,1,No,,Round of 16,No,0,, | ||
03-07-2018,Colombia,England,1,48,14,4,7,3,2,1,15,1,78,516,136,23,6,0,0,No,90,Round of 16,Yes,3,, | ||
03-07-2018,England,Colombia,1,51,16,2,9,5,7,2,24,3,82,571,143,13,2,0,0,Yes,57,Round of 16,Yes,4,, | ||
06-07-2018,Uruguay,France,0,42,11,4,6,1,4,0,15,0,67,322,103,17,2,0,0,No,,Quarter Finals,No,0,, | ||
06-07-2018,France,Uruguay,2,58,11,2,7,2,3,0,17,4,81,524,99,15,2,0,0,Yes,40,Quarter Finals,No,0,, | ||
06-07-2018,Brazil,Belgium,1,57,26,9,7,10,8,1,16,2,89,557,104,14,2,0,0,No,,Quarter Finals,No,0,1,13 | ||
06-07-2018,Belgium,Brazil,2,43,8,3,3,2,4,0,15,9,83,370,105,16,2,0,0,Yes,13,Quarter Finals,No,0,, | ||
07-07-2018,Sweden,England,0,43,7,3,3,1,1,2,8,0,74,379,107,10,2,0,0,No,,Quarter Finals,No,0,, | ||
07-07-2018,England,Sweden,2,57,12,2,4,6,6,1,12,3,80,525,110,7,1,0,0,Yes,30,Quarter Finals,No,0,, | ||
07-07-2018,Russia,Croatia,2,38,13,7,4,2,6,1,18,1,69,399,148,25,1,0,0,No,31,Quarter Finals,Yes,3,, | ||
07-07-2018,Croatia,Russia,2,62,17,3,10,4,8,0,26,5,82,753,139,18,4,0,0,Yes,39,Quarter Finals,Yes,4,, | ||
10-07-2018,France,Belgium,1,40,19,5,8,6,4,1,17,3,86,342,102,6,2,0,0,Yes,51,Semi- Finals,No,0,, | ||
10-07-2018,Belgium,France,0,60,9,3,5,1,5,1,7,4,90,629,102,16,3,0,0,No,,Semi- Finals,No,0,, | ||
11-07-2018,Croatia,England,2,54,22,7,11,4,8,1,17,0,79,622,143,23,2,0,0,Yes,68,Semi- Finals,No,0,, | ||
11-07-2018,England,Croatia,1,46,11,1,6,4,4,3,24,5,79,479,148,14,1,0,0,No,5,Semi- Finals,No,0,, | ||
14-07-2018,Belgium,England,2,43,12,4,3,5,4,1,5,5,88,510,108,11,1,0,0,Yes,4,3rd Place,No,0,, | ||
14-07-2018,England,Belgium,0,57,15,5,7,3,5,0,12,2,92,698,110,5,2,0,0,No,,3rd Place,No,0,, | ||
15-07-2018,France,Croatia,4,39,8,6,1,1,2,1,14,1,75,271,99,14,2,0,0,Yes,18,Final,No,0,1,18 | ||
15-07-2018,Croatia,France,2,61,15,3,8,4,6,1,15,3,83,547,100,13,1,0,0,No,28,Final,No,0,, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import numpy as np | ||
import pandas as pd | ||
from pdpbox import pdp | ||
import unittest | ||
from sklearn.model_selection import train_test_split | ||
from sklearn.tree import DecisionTreeClassifier | ||
|
||
class TestPdpbox(unittest.TestCase): | ||
def test_simple_pdp(self): | ||
# set up data | ||
data = pd.read_csv("/input/tests/data/fifa_2018_stats.csv") | ||
y = (data['Man of the Match'] == "Yes") | ||
feature_names = [i for i in data.columns if data[i].dtype in [np.int64]] | ||
X = data[feature_names] | ||
train_X, val_X, train_y, val_y = train_test_split(X, y, random_state=1) | ||
# Build simple model | ||
tree_model = DecisionTreeClassifier(random_state=0, | ||
max_depth=3).fit(train_X, train_y) | ||
|
||
# Set up pdp as table | ||
pdp_goals = pdp.pdp_isolate(model=tree_model, | ||
dataset=val_X, | ||
model_features=feature_names, | ||
feature='Goal Scored') | ||
# make plot | ||
pdp.pdp_plot(pdp_goals, 'Goal Scored') |