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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from datasets import Dataset, GeneratorBasedBuilder, DatasetInfo, Features, Value, SplitGenerator, Sequence
|
2 |
+
import pandas as pd
|
3 |
+
import tensorflow as tf
|
4 |
+
import csv
|
5 |
+
import sys
|
6 |
+
import ast
|
7 |
+
import json
|
8 |
+
import yaml
|
9 |
+
|
10 |
+
class Euro2020Dataset(GeneratorBasedBuilder):
|
11 |
+
VERSION = "1.0.0"
|
12 |
+
|
13 |
+
def _info(self):
|
14 |
+
return DatasetInfo(
|
15 |
+
description="Your dataset description here.",
|
16 |
+
features=Features({
|
17 |
+
"HomeTeamName": Value("string"),
|
18 |
+
"AwayTeamName": Value("string"),
|
19 |
+
"DateandTimeCET": Value("string"),
|
20 |
+
"MatchID": Value("int64"),
|
21 |
+
"RoundName": Value("string"),
|
22 |
+
"Stage": Value("string"),
|
23 |
+
"MatchDay": Value("int64"),
|
24 |
+
"Session": Value("int64"),
|
25 |
+
"MatchMinute": Value("int64"),
|
26 |
+
"InjuryTime": Value("int64"),
|
27 |
+
"NumberofPhases": Value("int64"),
|
28 |
+
"Phase": Value("int64"),
|
29 |
+
"ScoreHome": Value("int64"),
|
30 |
+
"ScoreAway": Value("int64"),
|
31 |
+
"MatchStatus": Value("string"),
|
32 |
+
"StadiumID": Value("int64"),
|
33 |
+
"RefereeWebName": Value("string"),
|
34 |
+
"NumberofMatchesRefereedPostMatch": Value("int64"),
|
35 |
+
"TotalNumberofMatchesRefereed": Value("int64"),
|
36 |
+
"NumberofMatchesRefereedinGroupStage": Value("int64"),
|
37 |
+
"NumberofMatchesRefereedinKnockoutStage": Value("int64"),
|
38 |
+
"AssistantRefereeWebName": Value("string"),
|
39 |
+
"Humidity": Value("int64"),
|
40 |
+
"Temperature": Value("int64"),
|
41 |
+
"WindSpeed": Value("int64"),
|
42 |
+
"MatchEvent": Features({
|
43 |
+
"1-First Half": Sequence(Features({
|
44 |
+
"Event": Value("string"),
|
45 |
+
"Minute": Value("int64"),
|
46 |
+
"Phase": Value("int64"),
|
47 |
+
"InjuryMinute": Value("int64"),
|
48 |
+
"TeamFromID": Value("float"),
|
49 |
+
"TeamToID": Value("float"),
|
50 |
+
"PlayerFromID": Value("float"),
|
51 |
+
"PlayerToID": Value("float"),
|
52 |
+
"Time": Value("string"),
|
53 |
+
"MatchEventAttribute": Value("string"), # contains both nan (float) and string, so use string to
|
54 |
+
# accommadate both
|
55 |
+
})),
|
56 |
+
"2-Second Half": Sequence(Features({
|
57 |
+
"Event": Value("string"),
|
58 |
+
"Minute": Value("int64"),
|
59 |
+
"Phase": Value("int64"),
|
60 |
+
"InjuryMinute": Value("int64"),
|
61 |
+
"TeamFromID": Value("float"),
|
62 |
+
"TeamToID": Value("float"),
|
63 |
+
"PlayerFromID": Value("float"),
|
64 |
+
"PlayerToID": Value("float"),
|
65 |
+
"Time": Value("string"),
|
66 |
+
"MatchEventAttribute": Value("string"),
|
67 |
+
})),
|
68 |
+
"3-Extra Time First Half": Sequence(Features({
|
69 |
+
"Event": Value("string"),
|
70 |
+
"Minute": Value("int64"),
|
71 |
+
"Phase": Value("int64"),
|
72 |
+
"InjuryMinute": Value("int64"),
|
73 |
+
"TeamFromID": Value("float"),
|
74 |
+
"TeamToID": Value("float"),
|
75 |
+
"PlayerFromID": Value("float"),
|
76 |
+
"PlayerToID": Value("float"),
|
77 |
+
"Time": Value("string"),
|
78 |
+
"MatchEventAttribute": Value("string"),
|
79 |
+
})),
|
80 |
+
"4-Extra Time Second Half": Sequence(Features({
|
81 |
+
"Event": Value("string"),
|
82 |
+
"Minute": Value("int64"),
|
83 |
+
"Phase": Value("int64"),
|
84 |
+
"InjuryMinute": Value("int64"),
|
85 |
+
"TeamFromID": Value("float"),
|
86 |
+
"TeamToID": Value("float"),
|
87 |
+
"PlayerFromID": Value("float"),
|
88 |
+
"PlayerToID": Value("float"),
|
89 |
+
"Time": Value("string"),
|
90 |
+
"MatchEventAttribute": Value("string"),
|
91 |
+
})),
|
92 |
+
"5-Penalty Shootout": Sequence(Features({
|
93 |
+
"Event": Value("string"),
|
94 |
+
"Minute": Value("int64"),
|
95 |
+
"Phase": Value("int64"),
|
96 |
+
"InjuryMinute": Value("int64"),
|
97 |
+
"TeamFromID": Value("float"),
|
98 |
+
"TeamToID": Value("float"),
|
99 |
+
"PlayerFromID": Value("float"),
|
100 |
+
"PlayerToID": Value("float"),
|
101 |
+
"Time": Value("string"),
|
102 |
+
"MatchEventAttribute": Value("string"),
|
103 |
+
})),
|
104 |
+
}),
|
105 |
+
"TeamLineUps": Features({
|
106 |
+
"HomeTeamLineUp": Features({
|
107 |
+
"Starting11": Sequence(Features({
|
108 |
+
"Country": Value("string"),
|
109 |
+
"ID": Value("int64"),
|
110 |
+
"OfficialName": Value("string"),
|
111 |
+
"OfficialSurname": Value("string"),
|
112 |
+
"ShortName": Value("string"),
|
113 |
+
"Role": Value("string"),
|
114 |
+
"JerseyNumber": Value("string"),
|
115 |
+
"IsGoalkeeper": Value("string"),
|
116 |
+
"JerseyName": Value("string"),
|
117 |
+
"IsCaptain": Value("string"),
|
118 |
+
"TacticX": Value("string"),
|
119 |
+
"TacticY": Value("string"),
|
120 |
+
"Numorder": Value("string"),
|
121 |
+
"IsBooked": Value("float"),
|
122 |
+
})),
|
123 |
+
"Benched Players": Sequence(Features({
|
124 |
+
"Country": Value("string"),
|
125 |
+
"ID": Value("int64"),
|
126 |
+
"OfficialName": Value("string"),
|
127 |
+
"OfficialSurname": Value("string"),
|
128 |
+
"ShortName": Value("string"),
|
129 |
+
"Role": Value("string"),
|
130 |
+
"JerseyNumber": Value("string"),
|
131 |
+
"IsGoalkeeper": Value("string"),
|
132 |
+
"JerseyName": Value("string"),
|
133 |
+
"IsCaptain": Value("string"),
|
134 |
+
"TacticX": Value("string"),
|
135 |
+
"TacticY": Value("string"),
|
136 |
+
"Numorder": Value("string"),
|
137 |
+
"IsBooked": Value("float"),
|
138 |
+
})),
|
139 |
+
"Staff": Sequence(Features({
|
140 |
+
"Country": Value("string"),
|
141 |
+
"ID": Value("int64"),
|
142 |
+
"OfficialName": Value("string"),
|
143 |
+
"OfficialSurname": Value("string"),
|
144 |
+
"ShortName": Value("string"),
|
145 |
+
"Role": Value("string"),
|
146 |
+
})),
|
147 |
+
}),
|
148 |
+
"AwayTeamLineUp": Features({
|
149 |
+
"Starting11": Sequence(Features({
|
150 |
+
"Country": Value("string"),
|
151 |
+
"ID": Value("int64"),
|
152 |
+
"OfficialName": Value("string"),
|
153 |
+
"OfficialSurname": Value("string"),
|
154 |
+
"ShortName": Value("string"),
|
155 |
+
"Role": Value("string"),
|
156 |
+
"JerseyNumber": Value("string"),
|
157 |
+
"IsGoalkeeper": Value("string"),
|
158 |
+
"JerseyName": Value("string"),
|
159 |
+
"IsCaptain": Value("string"),
|
160 |
+
"TacticX": Value("string"),
|
161 |
+
"TacticY": Value("string"),
|
162 |
+
"Numorder": Value("string"),
|
163 |
+
"IsBooked": Value("float"),
|
164 |
+
})),
|
165 |
+
"Benched Players": Sequence(Features({
|
166 |
+
"Country": Value("string"),
|
167 |
+
"ID": Value("int64"),
|
168 |
+
"OfficialName": Value("string"),
|
169 |
+
"OfficialSurname": Value("string"),
|
170 |
+
"ShortName": Value("string"),
|
171 |
+
"Role": Value("string"),
|
172 |
+
"JerseyNumber": Value("string"),
|
173 |
+
"IsGoalkeeper": Value("string"),
|
174 |
+
"JerseyName": Value("string"),
|
175 |
+
"IsCaptain": Value("string"),
|
176 |
+
"TacticX": Value("string"),
|
177 |
+
"TacticY": Value("string"),
|
178 |
+
"Numorder": Value("string"),
|
179 |
+
"IsBooked": Value("float"),
|
180 |
+
})),
|
181 |
+
"Staff": Sequence(Features({
|
182 |
+
"Country": Value("string"),
|
183 |
+
"ID": Value("int64"),
|
184 |
+
"OfficialName": Value("string"),
|
185 |
+
"OfficialSurname": Value("string"),
|
186 |
+
"ShortName": Value("string"),
|
187 |
+
"Role": Value("string"),
|
188 |
+
})),
|
189 |
+
}),
|
190 |
+
}),
|
191 |
+
"TeamStats": Features({
|
192 |
+
"HomeTeamStats": Features({
|
193 |
+
"attacking": Sequence(Features({
|
194 |
+
"TeamID": Value("int64"),
|
195 |
+
"TeamName": Value("string"),
|
196 |
+
"StatsID": Value("int64"),
|
197 |
+
"StatsName": Value("string"),
|
198 |
+
"Value": Value("string"),
|
199 |
+
"Rank": Value("int64"),
|
200 |
+
})),
|
201 |
+
"coverage&speed": Sequence(Features({
|
202 |
+
"TeamID": Value("int64"),
|
203 |
+
"TeamName": Value("string"),
|
204 |
+
"StatsID": Value("int64"),
|
205 |
+
"StatsName": Value("string"),
|
206 |
+
"Value": Value("string"),
|
207 |
+
"Rank": Value("int64"),
|
208 |
+
})),
|
209 |
+
"defending": Sequence(Features({
|
210 |
+
"TeamID": Value("int64"),
|
211 |
+
"TeamName": Value("string"),
|
212 |
+
"StatsID": Value("int64"),
|
213 |
+
"StatsName": Value("string"),
|
214 |
+
"Value": Value("string"),
|
215 |
+
"Rank": Value("int64"),
|
216 |
+
})),
|
217 |
+
"goalkeeping": Sequence(Features({
|
218 |
+
"TeamID": Value("int64"),
|
219 |
+
"TeamName": Value("string"),
|
220 |
+
"StatsID": Value("int64"),
|
221 |
+
"StatsName": Value("string"),
|
222 |
+
"Value": Value("string"),
|
223 |
+
"Rank": Value("int64"),
|
224 |
+
})),
|
225 |
+
"matches played": Sequence(Features({
|
226 |
+
"TeamID": Value("int64"),
|
227 |
+
"TeamName": Value("string"),
|
228 |
+
"StatsID": Value("int64"),
|
229 |
+
"StatsName": Value("string"),
|
230 |
+
"Value": Value("string"),
|
231 |
+
"Rank": Value("int64"),
|
232 |
+
})),
|
233 |
+
"possession": Sequence(Features({
|
234 |
+
"TeamID": Value("int64"),
|
235 |
+
"TeamName": Value("string"),
|
236 |
+
"StatsID": Value("int64"),
|
237 |
+
"StatsName": Value("string"),
|
238 |
+
"Value": Value("string"),
|
239 |
+
"Rank": Value("int64"),
|
240 |
+
})),
|
241 |
+
"time stats": Sequence(Features({
|
242 |
+
"TeamID": Value("int64"),
|
243 |
+
"TeamName": Value("string"),
|
244 |
+
"StatsID": Value("int64"),
|
245 |
+
"StatsName": Value("string"),
|
246 |
+
"Value": Value("string"),
|
247 |
+
"Rank": Value("int64"),
|
248 |
+
})),
|
249 |
+
"violation&foul&discipline": Sequence(Features({
|
250 |
+
"TeamID": Value("int64"),
|
251 |
+
"TeamName": Value("string"),
|
252 |
+
"StatsID": Value("int64"),
|
253 |
+
"StatsName": Value("string"),
|
254 |
+
"Value": Value("string"),
|
255 |
+
"Rank": Value("int64"),
|
256 |
+
})),
|
257 |
+
}),
|
258 |
+
"AwayTeamStats": Features({
|
259 |
+
"attacking": Sequence(Features({
|
260 |
+
"TeamID": Value("int64"),
|
261 |
+
"TeamName": Value("string"),
|
262 |
+
"StatsID": Value("int64"),
|
263 |
+
"StatsName": Value("string"),
|
264 |
+
"Value": Value("string"),
|
265 |
+
"Rank": Value("int64"),
|
266 |
+
})),
|
267 |
+
"coverage&speed": Sequence(Features({
|
268 |
+
"TeamID": Value("int64"),
|
269 |
+
"TeamName": Value("string"),
|
270 |
+
"StatsID": Value("int64"),
|
271 |
+
"StatsName": Value("string"),
|
272 |
+
"Value": Value("string"),
|
273 |
+
"Rank": Value("int64"),
|
274 |
+
})),
|
275 |
+
"defending": Sequence(Features({
|
276 |
+
"TeamID": Value("int64"),
|
277 |
+
"TeamName": Value("string"),
|
278 |
+
"StatsID": Value("int64"),
|
279 |
+
"StatsName": Value("string"),
|
280 |
+
"Value": Value("string"),
|
281 |
+
"Rank": Value("int64"),
|
282 |
+
})),
|
283 |
+
"goalkeeping": Sequence(Features({
|
284 |
+
"TeamID": Value("int64"),
|
285 |
+
"TeamName": Value("string"),
|
286 |
+
"StatsID": Value("int64"),
|
287 |
+
"StatsName": Value("string"),
|
288 |
+
"Value": Value("string"),
|
289 |
+
"Rank": Value("int64"),
|
290 |
+
})),
|
291 |
+
"matches played": Sequence(Features({
|
292 |
+
"TeamID": Value("int64"),
|
293 |
+
"TeamName": Value("string"),
|
294 |
+
"StatsID": Value("int64"),
|
295 |
+
"StatsName": Value("string"),
|
296 |
+
"Value": Value("string"),
|
297 |
+
"Rank": Value("int64"),
|
298 |
+
})),
|
299 |
+
"possession": Sequence(Features({
|
300 |
+
"TeamID": Value("int64"),
|
301 |
+
"TeamName": Value("string"),
|
302 |
+
"StatsID": Value("int64"),
|
303 |
+
"StatsName": Value("string"),
|
304 |
+
"Value": Value("string"),
|
305 |
+
"Rank": Value("int64"),
|
306 |
+
})),
|
307 |
+
"time stats": Sequence(Features({
|
308 |
+
"TeamID": Value("int64"),
|
309 |
+
"TeamName": Value("string"),
|
310 |
+
"StatsID": Value("int64"),
|
311 |
+
"StatsName": Value("string"),
|
312 |
+
"Value": Value("string"),
|
313 |
+
"Rank": Value("int64"),
|
314 |
+
})),
|
315 |
+
"violation&foul&discipline": Sequence(Features({
|
316 |
+
"TeamID": Value("int64"),
|
317 |
+
"TeamName": Value("string"),
|
318 |
+
"StatsID": Value("int64"),
|
319 |
+
"StatsName": Value("string"),
|
320 |
+
"Value": Value("string"),
|
321 |
+
"Rank": Value("int64"),
|
322 |
+
})),
|
323 |
+
}),
|
324 |
+
}),
|
325 |
+
"PlayerStats": Features({
|
326 |
+
"HomeTeamPlayerStats": Features({
|
327 |
+
"attacking": Sequence(Features({
|
328 |
+
"PlayerID": Value("int64"),
|
329 |
+
"PlayerName": Value("string"),
|
330 |
+
"PlayerSurname": Value("string"),
|
331 |
+
"IsGoalkeeper": Value("bool"),
|
332 |
+
"PlayedTime": Value("int64"),
|
333 |
+
"StatsID": Value("int64"),
|
334 |
+
"StatsName": Value("string"),
|
335 |
+
"Value": Value("string"),
|
336 |
+
"Rank": Value("int64"),
|
337 |
+
})),
|
338 |
+
"coverage&speed": Sequence(Features({
|
339 |
+
"PlayerID": Value("int64"),
|
340 |
+
"PlayerName": Value("string"),
|
341 |
+
"PlayerSurname": Value("string"),
|
342 |
+
"IsGoalkeeper": Value("bool"),
|
343 |
+
"PlayedTime": Value("int64"),
|
344 |
+
"StatsID": Value("int64"),
|
345 |
+
"StatsName": Value("string"),
|
346 |
+
"Value": Value("string"),
|
347 |
+
"Rank": Value("int64"),
|
348 |
+
})),
|
349 |
+
"defending": Sequence(Features({
|
350 |
+
"PlayerID": Value("int64"),
|
351 |
+
"PlayerName": Value("string"),
|
352 |
+
"PlayerSurname": Value("string"),
|
353 |
+
"IsGoalkeeper": Value("bool"),
|
354 |
+
"PlayedTime": Value("int64"),
|
355 |
+
"StatsID": Value("int64"),
|
356 |
+
"StatsName": Value("string"),
|
357 |
+
"Value": Value("string"),
|
358 |
+
"Rank": Value("int64"),
|
359 |
+
})),
|
360 |
+
"goalkeeping": Sequence(Features({
|
361 |
+
"PlayerID": Value("int64"),
|
362 |
+
"PlayerName": Value("string"),
|
363 |
+
"PlayerSurname": Value("string"),
|
364 |
+
"IsGoalkeeper": Value("bool"),
|
365 |
+
"PlayedTime": Value("int64"),
|
366 |
+
"StatsID": Value("int64"),
|
367 |
+
"StatsName": Value("string"),
|
368 |
+
"Value": Value("string"),
|
369 |
+
"Rank": Value("int64"),
|
370 |
+
})),
|
371 |
+
"matches played": Sequence(Features({
|
372 |
+
"PlayerID": Value("int64"),
|
373 |
+
"PlayerName": Value("string"),
|
374 |
+
"PlayerSurname": Value("string"),
|
375 |
+
"IsGoalkeeper": Value("bool"),
|
376 |
+
"PlayedTime": Value("int64"),
|
377 |
+
"StatsID": Value("int64"),
|
378 |
+
"StatsName": Value("string"),
|
379 |
+
"Value": Value("string"),
|
380 |
+
"Rank": Value("int64"),
|
381 |
+
})),
|
382 |
+
"possession": Sequence(Features({
|
383 |
+
"PlayerID": Value("int64"),
|
384 |
+
"PlayerName": Value("string"),
|
385 |
+
"PlayerSurname": Value("string"),
|
386 |
+
"IsGoalkeeper": Value("bool"),
|
387 |
+
"PlayedTime": Value("int64"),
|
388 |
+
"StatsID": Value("int64"),
|
389 |
+
"StatsName": Value("string"),
|
390 |
+
"Value": Value("string"),
|
391 |
+
"Rank": Value("int64"),
|
392 |
+
})),
|
393 |
+
"time stats": Sequence(Features({
|
394 |
+
"PlayerID": Value("int64"),
|
395 |
+
"PlayerName": Value("string"),
|
396 |
+
"PlayerSurname": Value("string"),
|
397 |
+
"IsGoalkeeper": Value("bool"),
|
398 |
+
"PlayedTime": Value("int64"),
|
399 |
+
"StatsID": Value("int64"),
|
400 |
+
"StatsName": Value("string"),
|
401 |
+
"Value": Value("string"),
|
402 |
+
"Rank": Value("int64"),
|
403 |
+
})),
|
404 |
+
"violation&foul&discipline": Sequence(Features({
|
405 |
+
"PlayerID": Value("int64"),
|
406 |
+
"PlayerName": Value("string"),
|
407 |
+
"PlayerSurname": Value("string"),
|
408 |
+
"IsGoalkeeper": Value("bool"),
|
409 |
+
"PlayedTime": Value("int64"),
|
410 |
+
"StatsID": Value("int64"),
|
411 |
+
"StatsName": Value("string"),
|
412 |
+
"Value": Value("string"),
|
413 |
+
"Rank": Value("int64"),
|
414 |
+
})),
|
415 |
+
}),
|
416 |
+
"AwayTeamPlayerStats": Features({
|
417 |
+
"attacking": Sequence(Features({
|
418 |
+
"PlayerID": Value("int64"),
|
419 |
+
"PlayerName": Value("string"),
|
420 |
+
"PlayerSurname": Value("string"),
|
421 |
+
"IsGoalkeeper": Value("bool"),
|
422 |
+
"PlayedTime": Value("int64"),
|
423 |
+
"StatsID": Value("int64"),
|
424 |
+
"StatsName": Value("string"),
|
425 |
+
"Value": Value("string"),
|
426 |
+
"Rank": Value("int64"),
|
427 |
+
})),
|
428 |
+
"coverage&speed": Sequence(Features({
|
429 |
+
"PlayerID": Value("int64"),
|
430 |
+
"PlayerName": Value("string"),
|
431 |
+
"PlayerSurname": Value("string"),
|
432 |
+
"IsGoalkeeper": Value("bool"),
|
433 |
+
"PlayedTime": Value("int64"),
|
434 |
+
"StatsID": Value("int64"),
|
435 |
+
"StatsName": Value("string"),
|
436 |
+
"Value": Value("string"),
|
437 |
+
"Rank": Value("int64"),
|
438 |
+
})),
|
439 |
+
"defending": Sequence(Features({
|
440 |
+
"PlayerID": Value("int64"),
|
441 |
+
"PlayerName": Value("string"),
|
442 |
+
"PlayerSurname": Value("string"),
|
443 |
+
"IsGoalkeeper": Value("bool"),
|
444 |
+
"PlayedTime": Value("int64"),
|
445 |
+
"StatsID": Value("int64"),
|
446 |
+
"StatsName": Value("string"),
|
447 |
+
"Value": Value("string"),
|
448 |
+
"Rank": Value("int64"),
|
449 |
+
})),
|
450 |
+
"goalkeeping": Sequence(Features({
|
451 |
+
"PlayerID": Value("int64"),
|
452 |
+
"PlayerName": Value("string"),
|
453 |
+
"PlayerSurname": Value("string"),
|
454 |
+
"IsGoalkeeper": Value("bool"),
|
455 |
+
"PlayedTime": Value("int64"),
|
456 |
+
"StatsID": Value("int64"),
|
457 |
+
"StatsName": Value("string"),
|
458 |
+
"Value": Value("string"),
|
459 |
+
"Rank": Value("int64"),
|
460 |
+
})),
|
461 |
+
"matches played": Sequence(Features({
|
462 |
+
"PlayerID": Value("int64"),
|
463 |
+
"PlayerName": Value("string"),
|
464 |
+
"PlayerSurname": Value("string"),
|
465 |
+
"IsGoalkeeper": Value("bool"),
|
466 |
+
"PlayedTime": Value("int64"),
|
467 |
+
"StatsID": Value("int64"),
|
468 |
+
"StatsName": Value("string"),
|
469 |
+
"Value": Value("string"),
|
470 |
+
"Rank": Value("int64"),
|
471 |
+
})),
|
472 |
+
"possession": Sequence(Features({
|
473 |
+
"PlayerID": Value("int64"),
|
474 |
+
"PlayerName": Value("string"),
|
475 |
+
"PlayerSurname": Value("string"),
|
476 |
+
"IsGoalkeeper": Value("bool"),
|
477 |
+
"PlayedTime": Value("int64"),
|
478 |
+
"StatsID": Value("int64"),
|
479 |
+
"StatsName": Value("string"),
|
480 |
+
"Value": Value("string"),
|
481 |
+
"Rank": Value("int64"),
|
482 |
+
})),
|
483 |
+
"time stats": Sequence(Features({
|
484 |
+
"PlayerID": Value("int64"),
|
485 |
+
"PlayerName": Value("string"),
|
486 |
+
"PlayerSurname": Value("string"),
|
487 |
+
"IsGoalkeeper": Value("bool"),
|
488 |
+
"PlayedTime": Value("int64"),
|
489 |
+
"StatsID": Value("int64"),
|
490 |
+
"StatsName": Value("string"),
|
491 |
+
"Value": Value("string"),
|
492 |
+
"Rank": Value("int64"),
|
493 |
+
})),
|
494 |
+
"violation&foul&discipline": Sequence(Features({
|
495 |
+
"PlayerID": Value("int64"),
|
496 |
+
"PlayerName": Value("string"),
|
497 |
+
"PlayerSurname": Value("string"),
|
498 |
+
"IsGoalkeeper": Value("bool"),
|
499 |
+
"PlayedTime": Value("int64"),
|
500 |
+
"StatsID": Value("int64"),
|
501 |
+
"StatsName": Value("string"),
|
502 |
+
"Value": Value("string"),
|
503 |
+
"Rank": Value("int64"),
|
504 |
+
})),
|
505 |
+
}),
|
506 |
+
}),
|
507 |
+
"PlayerPreMatchInfo": Features({
|
508 |
+
"HomeTeamPlayerInfo": Sequence(Features({
|
509 |
+
"PlayerID": Value("int64"),
|
510 |
+
"OfficialName": Value("string"),
|
511 |
+
"OfficialSurname": Value("string"),
|
512 |
+
"JerseyName": Value("string"),
|
513 |
+
"ShortName": Value("string"),
|
514 |
+
"GoalScored": Value("float"),
|
515 |
+
"CleanSheet": Value("float"),
|
516 |
+
"SuspendedIfBooked": Value("bool"),
|
517 |
+
"Role": Value("string"),
|
518 |
+
})),
|
519 |
+
"AwayTeamPlayerInfo": Sequence(Features({
|
520 |
+
"PlayerID": Value("int64"),
|
521 |
+
"OfficialName": Value("string"),
|
522 |
+
"OfficialSurname": Value("string"),
|
523 |
+
"JerseyName": Value("string"),
|
524 |
+
"ShortName": Value("string"),
|
525 |
+
"GoalScored": Value("float"),
|
526 |
+
"CleanSheet": Value("float"),
|
527 |
+
"SuspendedIfBooked": Value("bool"),
|
528 |
+
"Role": Value("string"),
|
529 |
+
})),
|
530 |
+
}),
|
531 |
+
}),
|
532 |
+
supervised_keys=None,
|
533 |
+
homepage="Optional dataset homepage",
|
534 |
+
license= "j",
|
535 |
+
citation="Optional citation"
|
536 |
+
)
|
537 |
+
|
538 |
+
def _split_generators(self, dl_manager):
|
539 |
+
file_url = "https://drive.google.com/uc?id=1RKoAQwq68LASd4ret_OKYUkF4B4m6hnu"
|
540 |
+
downloaded_file = dl_manager.download(file_url)
|
541 |
+
#dl_path = dl_manager.download_and_extract({'train_csv': file_url})
|
542 |
+
|
543 |
+
return [
|
544 |
+
SplitGenerator(
|
545 |
+
name="train",
|
546 |
+
gen_kwargs={"filepath": downloaded_file},#dl_path['train_csv']},
|
547 |
+
),
|
548 |
+
]
|
549 |
+
|
550 |
+
# Increase the maximum field size limit
|
551 |
+
csv.field_size_limit(sys.maxsize)
|
552 |
+
|
553 |
+
def _generate_examples(self, filepath):
|
554 |
+
#fobj = tf.io.gfile.GFile(filepath)
|
555 |
+
#reader = csv.DictReader(fobj)
|
556 |
+
with open(filepath, encoding="utf-8") as f:
|
557 |
+
reader = csv.DictReader(f)
|
558 |
+
for id, row in enumerate(reader):
|
559 |
+
|
560 |
+
match_event_str = row["MatchEvent"]
|
561 |
+
#match_event_replaced = match_event_str.replace("'", '"')
|
562 |
+
#match_event_replaced = match_event_str.replace(": nan: ", ": None: ")
|
563 |
+
match_event = yaml.safe_load(match_event_str)
|
564 |
+
|
565 |
+
team_linup_str = row["TeamLineUps"]
|
566 |
+
team_linup_replaced = team_linup_str.replace(": nan", ": None")
|
567 |
+
team_linup = ast.literal_eval(team_linup_replaced)
|
568 |
+
|
569 |
+
team_stats_str = row["TeamStats"]
|
570 |
+
#team_stats_replaced = team_stats_str.replace("'", '"')
|
571 |
+
#team_stats_replaced = team_stats_replaced.replace(": nan", ": null")
|
572 |
+
team_stats = yaml.safe_load(team_stats_str)
|
573 |
+
|
574 |
+
player_stats_str = row["PlayerStats"]
|
575 |
+
#player_stats_replaced = player_stats_str.replace("'", '"')
|
576 |
+
#player_stats_replaced = player_stats_replaced.replace(": nan", ": null")
|
577 |
+
player_stats_replaced = player_stats_str.replace('"', '\"')
|
578 |
+
player_stats = yaml.safe_load(player_stats_replaced)
|
579 |
+
|
580 |
+
pre_match_str = row["PlayerPreMatchInfo"]
|
581 |
+
#pre_match_replaced = pre_match_str.replace("'", '"')
|
582 |
+
#pre_match_replaced = pre_match_replaced.replace(": nan", ": null")
|
583 |
+
pre_match_info = yaml.safe_load(pre_match_str)
|
584 |
+
|
585 |
+
yield id, {
|
586 |
+
"HomeTeamName": row["HomeTeamName"],
|
587 |
+
"AwayTeamName": row["AwayTeamName"],
|
588 |
+
"DateandTimeCET": row["DateandTimeCET"],
|
589 |
+
"MatchID": row["MatchID"],
|
590 |
+
"RoundName": row["RoundName"],
|
591 |
+
"Stage": row["Stage"],
|
592 |
+
"MatchDay": row["MatchDay"],
|
593 |
+
"Session": row["Session"],
|
594 |
+
"MatchMinute": row["MatchMinute"],
|
595 |
+
"InjuryTime": row["InjuryTime"],
|
596 |
+
"NumberOfPhases": row["NumberOfPhases"],
|
597 |
+
"Phase": row["Phase"],
|
598 |
+
"ScoreHome": row["ScoreHome"],
|
599 |
+
"ScoreAway": row["ScoreAway"],
|
600 |
+
"MatchStatus": row["MatchStatus"],
|
601 |
+
"StadiumID": row["StadiumID"],
|
602 |
+
"RefereeWebName": row["RefereeWebName"],
|
603 |
+
"NumberofMatchesRefereedPostMatch": row["NumberofMatchesRefereedPostMatch"],
|
604 |
+
"TotalNumberofMatchesRefereed": row["TotalNumberofMatchesRefereed"],
|
605 |
+
"NumberofMatchesRefereedinGroupStage": row["NumberofMatchesRefereedinGroupStage"],
|
606 |
+
"NumberofMatchesRefereedinKnockoutStage": row["NumberofMatchesRefereedinKnockoutStage"],
|
607 |
+
"AssistantRefereeWebName": row["AssistantRefereeWebName"],
|
608 |
+
"Humidity": row["Humidity"],
|
609 |
+
"Temperature": row["Temperature"],
|
610 |
+
"WindSpeed": row["WindSpeed"],
|
611 |
+
"MatchEvent": match_event,
|
612 |
+
"TeamLineUps": team_linup,
|
613 |
+
"TeamStats": team_stats,
|
614 |
+
"PlayerStats": player_stats,
|
615 |
+
"PlayerPreMatchInfo": pre_match_info,
|
616 |
+
}
|
617 |
+
|