ForzaJuve1
commited on
Commit
•
1715583
1
Parent(s):
ab18d14
Update Integration
Browse files- Integration +111 -31
Integration
CHANGED
@@ -2,52 +2,132 @@ from datasets import DatasetBuilder, DatasetInfo, Features, Value, SplitGenerato
|
|
2 |
import pandas as pd
|
3 |
|
4 |
class Euro2020Dataset(DatasetBuilder):
|
5 |
-
VERSION = "1.0.0"
|
6 |
-
BUILDER_CONFIGS = ["euro2020"] # Not strictly necessary but useful for multiple datasets
|
7 |
|
8 |
def _info(self):
|
9 |
return DatasetInfo(
|
10 |
description="Your dataset description here.",
|
11 |
features=Features({
|
12 |
-
"
|
13 |
-
"
|
14 |
-
"
|
15 |
-
"
|
16 |
-
"
|
17 |
-
"
|
18 |
-
"
|
19 |
-
"
|
20 |
-
"
|
21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
}),
|
23 |
supervised_keys=None,
|
24 |
homepage="Optional dataset homepage",
|
25 |
-
|
|
|
26 |
)
|
27 |
|
28 |
def _split_generators(self, dl_manager):
|
29 |
-
#
|
30 |
-
#
|
31 |
return [
|
32 |
SplitGenerator(
|
33 |
name="train",
|
34 |
-
gen_kwargs={"filepath": "
|
35 |
),
|
36 |
]
|
37 |
|
38 |
-
def _generate_examples(self, filepath):
|
39 |
-
#
|
40 |
-
data = pd.read_csv(filepath)
|
41 |
-
for idx, row in data.iterrows():
|
42 |
-
yield idx, {
|
43 |
-
"PlayerID": row["PlayerID"],
|
44 |
-
"PlayerName": row["PlayerName"],
|
45 |
-
"PlayerSurname": row["PlayerSurname"],
|
46 |
-
"IsGoalkeeper": row["IsGoalkeeper"],
|
47 |
-
"PlayedTime": row["PlayedTime"],
|
48 |
-
"StatsID": row["StatsID"],
|
49 |
-
"StatsName": row["StatsName"],
|
50 |
-
"Value": row["Value"],
|
51 |
-
"Rank": row["Rank"],
|
52 |
# Make sure to include all fields defined in _info
|
53 |
-
}
|
|
|
2 |
import pandas as pd
|
3 |
|
4 |
class Euro2020Dataset(DatasetBuilder):
|
5 |
+
VERSION = "1.0.0"
|
|
|
6 |
|
7 |
def _info(self):
|
8 |
return DatasetInfo(
|
9 |
description="Your dataset description here.",
|
10 |
features=Features({
|
11 |
+
"HomeTeamName": Value("string"),
|
12 |
+
"AwayTeamName": Value("string"),
|
13 |
+
"DateandTimeCET": Value("string"),
|
14 |
+
"MatchID": Value("int64"),
|
15 |
+
"RoundName": Value("string"),
|
16 |
+
"Stage": Value("string"),
|
17 |
+
"MatchDay": Value("int64"),
|
18 |
+
"Session": Value("int64"),
|
19 |
+
"MatchMinute": Value("int64"),
|
20 |
+
"InjuryTime": Value("int64"),
|
21 |
+
"NumberofPhases": Value("int64"),
|
22 |
+
"Phase": Value("int64"),
|
23 |
+
"ScoreHome": Value("int64"),
|
24 |
+
"ScoreAway": Value("int64"),
|
25 |
+
"MatchStatus": Value("string"),
|
26 |
+
"StadiumID": Value("int64"),
|
27 |
+
"NumberofMatchesRefereedPostMatch": Value("int64"),
|
28 |
+
"TotalNumberofMatchesRefereed": Value("int64"),
|
29 |
+
"NumberofMatchesRefereedinGroupStage": Value("int64"),
|
30 |
+
"NumberofMatchesRefereedinKnockoutStage": Value("int64"),
|
31 |
+
"AssistantRefereeWebName": Value("string"),
|
32 |
+
"Humidity": Value("int64"),
|
33 |
+
"Temperature": Value("int64"),
|
34 |
+
"WindSpeed": Value("int64"),
|
35 |
+
"MatchEvent": Features({
|
36 |
+
"1-First Half": Features({
|
37 |
+
"Event": Value("string"),
|
38 |
+
"Minute": Value("int"),
|
39 |
+
"Phase": Value("int"),
|
40 |
+
"InjuryMinute": Value("int"),
|
41 |
+
"TeamFromID": Value("float"),
|
42 |
+
"TeamToID": Value("float"),
|
43 |
+
"PlayerFromID": Value("float"),
|
44 |
+
"PlayerToID": Value("float"),
|
45 |
+
"Time": Value("string"),
|
46 |
+
"MatchEventAttribute": Value("float"),
|
47 |
+
}),
|
48 |
+
"2-Second Half": Features({
|
49 |
+
"Event": Value("string"),
|
50 |
+
"Minute": Value("int"),
|
51 |
+
"Phase": Value("int"),
|
52 |
+
"InjuryMinute": Value("int"),
|
53 |
+
"TeamFromID": Value("float"),
|
54 |
+
"TeamToID": Value("float"),
|
55 |
+
"PlayerFromID": Value("float"),
|
56 |
+
"PlayerToID": Value("float"),
|
57 |
+
"Time": Value("string"),
|
58 |
+
"MatchEventAttribute": Value("float"),
|
59 |
+
}),
|
60 |
+
"3-Extra Time First Half": Features({
|
61 |
+
"Event": Value("string"),
|
62 |
+
"Minute": Value("int"),
|
63 |
+
"Phase": Value("int"),
|
64 |
+
"InjuryMinute": Value("int"),
|
65 |
+
"TeamFromID": Value("float"),
|
66 |
+
"TeamToID": Value("float"),
|
67 |
+
"PlayerFromID": Value("float"),
|
68 |
+
"PlayerToID": Value("float"),
|
69 |
+
"Time": Value("string"),
|
70 |
+
"MatchEventAttribute": Value("float"),
|
71 |
+
}),
|
72 |
+
"4-Extra Time Second Half": Features({
|
73 |
+
"Event": Value("string"),
|
74 |
+
"Minute": Value("int"),
|
75 |
+
"Phase": Value("int"),
|
76 |
+
"InjuryMinute": Value("int"),
|
77 |
+
"TeamFromID": Value("float"),
|
78 |
+
"TeamToID": Value("float"),
|
79 |
+
"PlayerFromID": Value("float"),
|
80 |
+
"PlayerToID": Value("float"),
|
81 |
+
"Time": Value("string"),
|
82 |
+
"MatchEventAttribute": Value("float"),
|
83 |
+
}),
|
84 |
+
"5-Penalty Shootout": Features({
|
85 |
+
"Event": Value("string"),
|
86 |
+
"Minute": Value("int"),
|
87 |
+
"Phase": Value("int"),
|
88 |
+
"InjuryMinute": Value("int"),
|
89 |
+
"TeamFromID": Value("float"),
|
90 |
+
"TeamToID": Value("float"),
|
91 |
+
"PlayerFromID": Value("float"),
|
92 |
+
"PlayerToID": Value("float"),
|
93 |
+
"Time": Value("string"),
|
94 |
+
"MatchEventAttribute": Value("float"),
|
95 |
+
}),
|
96 |
+
}),
|
97 |
+
"TeamLineUps": Value("dict"),
|
98 |
+
"TeamStats": Value("dict"),
|
99 |
+
"PlayerStats": Value("dict"),
|
100 |
+
"PlayerPreMatchInfo": Value("dict"),
|
101 |
}),
|
102 |
supervised_keys=None,
|
103 |
homepage="Optional dataset homepage",
|
104 |
+
license= "",
|
105 |
+
citation="Optional citation"
|
106 |
)
|
107 |
|
108 |
def _split_generators(self, dl_manager):
|
109 |
+
# Since the final processed dataset is a single CSV file that combines the content from numerous rows to only 51 rows,
|
110 |
+
# with each row representing the information of each game, I wil just use a single 'train' split and no need for test / validation.
|
111 |
return [
|
112 |
SplitGenerator(
|
113 |
name="train",
|
114 |
+
gen_kwargs={"filepath": "/Users/chuhanguo/Desktop/Winter 2024/STA 663/Euro2020.csv"}
|
115 |
),
|
116 |
]
|
117 |
|
118 |
+
#def _generate_examples(self, filepath):
|
119 |
+
#Here we read the CSV file and yield examples
|
120 |
+
#data = pd.read_csv(filepath)
|
121 |
+
#for idx, row in data.iterrows():
|
122 |
+
#yield idx, {
|
123 |
+
#"PlayerID": row["PlayerID"],
|
124 |
+
#"PlayerName": row["PlayerName"],
|
125 |
+
#"PlayerSurname": row["PlayerSurname"],
|
126 |
+
#"IsGoalkeeper": row["IsGoalkeeper"],
|
127 |
+
#"PlayedTime": row["PlayedTime"],
|
128 |
+
#"StatsID": row["StatsID"],
|
129 |
+
#"StatsName": row["StatsName"],
|
130 |
+
#"Value": row["Value"],
|
131 |
+
#"Rank": row["Rank"],
|
132 |
# Make sure to include all fields defined in _info
|
133 |
+
#}
|