File size: 6,363 Bytes
ab18d14
 
 
 
1715583
ab18d14
 
 
 
 
1715583
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ab18d14
 
 
1715583
 
ab18d14
 
 
1715583
 
87dfcb1
 
 
 
 
ab18d14
 
 
87dfcb1
ab18d14
 
 
1715583
 
 
 
 
 
 
 
 
 
 
 
 
 
ab18d14
1715583
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
from datasets import DatasetBuilder, DatasetInfo, Features, Value, SplitGenerator
import pandas as pd

class Euro2020Dataset(DatasetBuilder):
    VERSION = "1.0.0" 

    def _info(self):
        return DatasetInfo(
            description="Your dataset description here.",
            features=Features({
                "HomeTeamName": Value("string"),
                "AwayTeamName": Value("string"),
                "DateandTimeCET": Value("string"),
                "MatchID": Value("int64"),
                "RoundName": Value("string"),
                "Stage": Value("string"),
                "MatchDay": Value("int64"),
                "Session": Value("int64"),
                "MatchMinute": Value("int64"),
                "InjuryTime": Value("int64"),
                "NumberofPhases": Value("int64"),
                "Phase": Value("int64"),
                "ScoreHome": Value("int64"),
                "ScoreAway": Value("int64"),
                "MatchStatus": Value("string"),
                "StadiumID": Value("int64"),
                "NumberofMatchesRefereedPostMatch": Value("int64"),
                "TotalNumberofMatchesRefereed": Value("int64"),
                "NumberofMatchesRefereedinGroupStage": Value("int64"),
                "NumberofMatchesRefereedinKnockoutStage": Value("int64"),
                "AssistantRefereeWebName": Value("string"),
                "Humidity": Value("int64"),
                "Temperature": Value("int64"),
                "WindSpeed": Value("int64"),
                "MatchEvent": Features({
                    "1-First Half": Features({
                        "Event": Value("string"),
                        "Minute": Value("int"),
                        "Phase": Value("int"),
                        "InjuryMinute": Value("int"),
                        "TeamFromID": Value("float"),
                        "TeamToID": Value("float"),
                        "PlayerFromID": Value("float"),
                        "PlayerToID": Value("float"),
                        "Time": Value("string"),
                        "MatchEventAttribute": Value("float"),
                    }),
                    "2-Second Half": Features({
                        "Event": Value("string"),
                        "Minute": Value("int"),
                        "Phase": Value("int"),
                        "InjuryMinute": Value("int"),
                        "TeamFromID": Value("float"),
                        "TeamToID": Value("float"),
                        "PlayerFromID": Value("float"),
                        "PlayerToID": Value("float"),
                        "Time": Value("string"),
                        "MatchEventAttribute": Value("float"),
                    }),
                    "3-Extra Time First Half": Features({
                        "Event": Value("string"),
                        "Minute": Value("int"),
                        "Phase": Value("int"),
                        "InjuryMinute": Value("int"),
                        "TeamFromID": Value("float"),
                        "TeamToID": Value("float"),
                        "PlayerFromID": Value("float"),
                        "PlayerToID": Value("float"),
                        "Time": Value("string"),
                        "MatchEventAttribute": Value("float"),
                    }),
                    "4-Extra Time Second Half": Features({
                        "Event": Value("string"),
                        "Minute": Value("int"),
                        "Phase": Value("int"),
                        "InjuryMinute": Value("int"),
                        "TeamFromID": Value("float"),
                        "TeamToID": Value("float"),
                        "PlayerFromID": Value("float"),
                        "PlayerToID": Value("float"),
                        "Time": Value("string"),
                        "MatchEventAttribute": Value("float"),
                    }),
                    "5-Penalty Shootout": Features({
                        "Event": Value("string"),
                        "Minute": Value("int"),
                        "Phase": Value("int"),
                        "InjuryMinute": Value("int"),
                        "TeamFromID": Value("float"),
                        "TeamToID": Value("float"),
                        "PlayerFromID": Value("float"),
                        "PlayerToID": Value("float"),
                        "Time": Value("string"),
                        "MatchEventAttribute": Value("float"),
                    }),
                }),
                "TeamLineUps": Value("dict"),
                "TeamStats": Value("dict"),
                "PlayerStats": Value("dict"),
                "PlayerPreMatchInfo": Value("dict"),
            }),
            supervised_keys=None,
            homepage="Optional dataset homepage",
            license= "",
            citation="Optional citation"
        )

    def _split_generators(self, dl_manager):
        # Since the final processed dataset is a single CSV file that combines the content from numerous rows to only 51 rows,
        # with each row representing the information of each game, I wil just use a single 'train' split and no need for test / validation.
        
        Euro2020_df = pd.read_csv("/Users/chuhanguo/Desktop/Winter 2024/STA 663/Euro2020.csv")
        train_path = "ForzaJuve1/UEFA_Euro_2020_Data/Euro2020.csv"
        Euro2020_df.to_csv(train_path, index = False)

        return [
            SplitGenerator(
                name="train",
                gen_kwargs={"filepath": train_path}
            ),
        ]

    #def _generate_examples(self, filepath):
        #Here we read the CSV file and yield examples
        #data = pd.read_csv(filepath)
        #for idx, row in data.iterrows():
            #yield idx, {
                #"PlayerID": row["PlayerID"],
                #"PlayerName": row["PlayerName"],
                #"PlayerSurname": row["PlayerSurname"],
                #"IsGoalkeeper": row["IsGoalkeeper"],
                #"PlayedTime": row["PlayedTime"],
                #"StatsID": row["StatsID"],
                #"StatsName": row["StatsName"],
                #"Value": row["Value"],
                #"Rank": row["Rank"],
                # Make sure to include all fields defined in _info
            #}