restructure samples
Browse files- nba_tracking_data_15_16.py +12 -12
nba_tracking_data_15_16.py
CHANGED
@@ -72,8 +72,9 @@ def identify_offense(row):
|
|
72 |
class NbaTrackingConfig(datasets.BuilderConfig):
|
73 |
"""BuilderConfig for NbaTracking"""
|
74 |
|
75 |
-
def __init__(self, **kwargs):
|
76 |
super().__init__(**kwargs)
|
|
|
77 |
|
78 |
class NbaTracking(datasets.GeneratorBasedBuilder):
|
79 |
"""Tracking data for all games of 2015-2016 season in forms of coordinates for players and ball at each moment."""
|
@@ -82,26 +83,25 @@ class NbaTracking(datasets.GeneratorBasedBuilder):
|
|
82 |
|
83 |
BUILDER_CONFIGS = [
|
84 |
NbaTrackingConfig(
|
85 |
-
name = "tiny"
|
|
|
86 |
),
|
87 |
NbaTrackingConfig(
|
88 |
-
name = "small"
|
|
|
89 |
),
|
90 |
NbaTrackingConfig(
|
91 |
-
name = "medium"
|
|
|
92 |
),
|
93 |
NbaTrackingConfig(
|
94 |
-
name = "full"
|
|
|
95 |
)
|
96 |
]
|
97 |
-
|
98 |
random.seed(9)
|
99 |
-
|
100 |
-
items = random.sample(items, 5)
|
101 |
-
elif self.config.name == "small":
|
102 |
-
items = random.sample(items, 25)
|
103 |
-
elif self.config.name == "medium":
|
104 |
-
items = random.sample(items, 100)
|
105 |
|
106 |
_URLS = {}
|
107 |
for game in items:
|
|
|
72 |
class NbaTrackingConfig(datasets.BuilderConfig):
|
73 |
"""BuilderConfig for NbaTracking"""
|
74 |
|
75 |
+
def __init__(self, samples, **kwargs):
|
76 |
super().__init__(**kwargs)
|
77 |
+
self.samples = samples
|
78 |
|
79 |
class NbaTracking(datasets.GeneratorBasedBuilder):
|
80 |
"""Tracking data for all games of 2015-2016 season in forms of coordinates for players and ball at each moment."""
|
|
|
83 |
|
84 |
BUILDER_CONFIGS = [
|
85 |
NbaTrackingConfig(
|
86 |
+
name = "tiny",
|
87 |
+
samples = 5
|
88 |
),
|
89 |
NbaTrackingConfig(
|
90 |
+
name = "small",
|
91 |
+
samples = 25
|
92 |
),
|
93 |
NbaTrackingConfig(
|
94 |
+
name = "medium",
|
95 |
+
samples = 100
|
96 |
),
|
97 |
NbaTrackingConfig(
|
98 |
+
name = "full",
|
99 |
+
samples = len(items)
|
100 |
)
|
101 |
]
|
102 |
+
|
103 |
random.seed(9)
|
104 |
+
items = random.sample(items, samples)
|
|
|
|
|
|
|
|
|
|
|
105 |
|
106 |
_URLS = {}
|
107 |
for game in items:
|