Datasets:

ArXiv:
License:
lynn-miller commited on
Commit
7330ff0
·
verified ·
1 Parent(s): 8e6652d

Upload WISDM.py

Browse files
Files changed (1) hide show
  1. WISDM.py +13 -70
WISDM.py CHANGED
@@ -11,45 +11,21 @@
11
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
  # See the License for the specific language governing permissions and
13
  # limitations under the License.
14
- # TODO: Address all TODOs and remove all explanatory comments
15
- """TODO: Add a description here."""
16
 
17
 
18
  import numpy as np
19
- #import json
20
  import os
21
-
22
  import datasets
23
 
24
 
25
- # TODO: Add BibTeX citation
26
- # Find for instance the citation on arxiv or on the dataset repo/website
27
- _CITATION = """\
28
- @InProceedings{huggingface:dataset,
29
- title = {A great new dataset},
30
- author={huggingface, Inc.
31
- },
32
- year={2020}
33
- }
34
- """
35
-
36
- # TODO: Add description of the dataset here
37
- # You can copy an official description
38
  _DATASET = "WISDM"
39
  _SHAPE = (3, 100)
40
- _DESCRIPTION = """\
41
- This new dataset is designed to solve this great NLP task and is crafted with a lot of care.
42
- """
43
-
44
- # TODO: Add a link to an official homepage for the dataset here
45
- _HOMEPAGE = ""
46
-
47
- # TODO: Add the licence for the dataset here if you can find it
48
- _LICENSE = ""
49
 
50
- # TODO: Add link to the official dataset URLs here
51
- # The HuggingFace Datasets library doesn't host the datasets but only points to the original files.
52
- # This can be an arbitrary nested dict/list of URLs (see below in `_split_generators` method)
53
  _URLS = {
54
  'data': f"{_DATASET}_X.npy",
55
  'labels': f"{_DATASET}_y.npy",
@@ -61,23 +37,11 @@ _URLS = {
61
  }
62
 
63
 
64
- # TODO: Name of the dataset usually matches the script name with CamelCase instead of snake_case
65
  class Monster(datasets.GeneratorBasedBuilder):
66
- """TODO: Short description of my dataset."""
67
 
68
- VERSION = datasets.Version("1.1.0")
69
 
70
- # This is an example of a dataset with multiple configurations.
71
- # If you don't want/need to define several sub-sets in your dataset,
72
- # just remove the BUILDER_CONFIG_CLASS and the BUILDER_CONFIGS attributes.
73
-
74
- # If you need to make complex sub-parts in the datasets with configurable options
75
- # You can create your own builder configuration class to store attribute, inheriting from datasets.BuilderConfig
76
- # BUILDER_CONFIG_CLASS = MyBuilderConfig
77
-
78
- # You will be able to load one or the other configurations in the following list with
79
- # data = datasets.load_dataset('my_dataset', 'first_domain')
80
- # data = datasets.load_dataset('my_dataset', 'second_domain')
81
  BUILDER_CONFIGS = [
82
  datasets.BuilderConfig(name="full", version=VERSION, description="All data"),
83
  datasets.BuilderConfig(name="fold_0", version=VERSION, description="Cross-validation fold 0"),
@@ -87,47 +51,31 @@ class Monster(datasets.GeneratorBasedBuilder):
87
  datasets.BuilderConfig(name="fold_4", version=VERSION, description="Cross-validation fold 4"),
88
  ]
89
 
90
- DEFAULT_CONFIG_NAME = "full" # It's not mandatory to have a default configuration. Just use one if it make sense.
91
 
92
  def _info(self):
93
- # TODO: This method specifies the datasets.DatasetInfo object which contains informations and typings for the dataset
94
  features = datasets.Features(
95
  {
96
  "X": datasets.Array2D(_SHAPE, "float32"),
97
  "y": datasets.Value("int64")
98
- # These are the features of your dataset like images, labels ...
99
  }
100
  )
101
  return datasets.DatasetInfo(
102
- # This is the description that will appear on the datasets page.
103
- description=_DESCRIPTION,
104
- # This defines the different columns of the dataset and their types
105
- features=features, # Here we define them above because they are different between the two configurations
106
- # If there's a common (input, target) tuple from the features, uncomment supervised_keys line below and
107
- # specify them. They'll be used if as_supervised=True in builder.as_dataset.
108
  supervised_keys=("X", "y"),
109
- # Homepage of the dataset for documentation
110
- homepage=_HOMEPAGE,
111
- # License for the dataset if available
112
- license=_LICENSE,
113
- # Citation for the dataset
114
- citation=_CITATION,
115
  )
116
 
117
  def _split_generators(self, dl_manager):
118
- # TODO: This method is tasked with downloading/extracting the data and defining the splits depending on the configuration
119
- # If several configurations are possible (listed in BUILDER_CONFIGS), the configuration selected by the user is in self.config.name
120
-
121
- # dl_manager is a datasets.download.DownloadManager that can be used to download and extract URLS
122
- # It can accept any type or nested list/dict and will give back the same structure with the url replaced with path to local files.
123
- # By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
124
  data = dl_manager.download_and_extract(_URLS['data'])
125
  labels = dl_manager.download_and_extract(_URLS['labels'])
126
  if self.config.name == "full":
127
  return [
128
  datasets.SplitGenerator(
129
  name=datasets.Split.TRAIN,
130
- # These kwargs will be passed to _generate_examples
131
  gen_kwargs={
132
  "data": data,
133
  "labels": labels,
@@ -141,7 +89,6 @@ class Monster(datasets.GeneratorBasedBuilder):
141
  return [
142
  datasets.SplitGenerator(
143
  name=datasets.Split.TRAIN,
144
- # These kwargs will be passed to _generate_examples
145
  gen_kwargs={
146
  "data": data,
147
  "labels": labels,
@@ -151,7 +98,6 @@ class Monster(datasets.GeneratorBasedBuilder):
151
  ),
152
  datasets.SplitGenerator(
153
  name=datasets.Split.TEST,
154
- # These kwargs will be passed to _generate_examples
155
  gen_kwargs={
156
  "data": data,
157
  "labels": labels,
@@ -161,10 +107,7 @@ class Monster(datasets.GeneratorBasedBuilder):
161
  ),
162
  ]
163
 
164
- # method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
165
  def _generate_examples(self, data, labels, fold, split):
166
- # TODO: This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
167
- # The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
168
  X = np.load(data)
169
  y = np.load(labels)
170
  if self.config.name == "full":
 
11
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
  # See the License for the specific language governing permissions and
13
  # limitations under the License.
14
+ """Monster-Monash custom downloader"""
 
15
 
16
 
17
  import numpy as np
 
18
  import os
 
19
  import datasets
20
 
21
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  _DATASET = "WISDM"
23
  _SHAPE = (3, 100)
24
+ #_DESCRIPTION = ""
25
+ #_CITATION = ""
26
+ #_HOMEPAGE = ""
27
+ #_LICENSE = ""
 
 
 
 
 
28
 
 
 
 
29
  _URLS = {
30
  'data': f"{_DATASET}_X.npy",
31
  'labels': f"{_DATASET}_y.npy",
 
37
  }
38
 
39
 
 
40
  class Monster(datasets.GeneratorBasedBuilder):
41
+ """Generic Monster class for all downloader."""
42
 
43
+ VERSION = datasets.Version("1.0.0")
44
 
 
 
 
 
 
 
 
 
 
 
 
45
  BUILDER_CONFIGS = [
46
  datasets.BuilderConfig(name="full", version=VERSION, description="All data"),
47
  datasets.BuilderConfig(name="fold_0", version=VERSION, description="Cross-validation fold 0"),
 
51
  datasets.BuilderConfig(name="fold_4", version=VERSION, description="Cross-validation fold 4"),
52
  ]
53
 
54
+ DEFAULT_CONFIG_NAME = "full" # By default all data is returned in a single split.
55
 
56
  def _info(self):
 
57
  features = datasets.Features(
58
  {
59
  "X": datasets.Array2D(_SHAPE, "float32"),
60
  "y": datasets.Value("int64")
 
61
  }
62
  )
63
  return datasets.DatasetInfo(
64
+ # description=_DESCRIPTION,
65
+ features=features,
 
 
 
 
66
  supervised_keys=("X", "y"),
67
+ # homepage=_HOMEPAGE,
68
+ # license=_LICENSE,
69
+ # citation=_CITATION,
 
 
 
70
  )
71
 
72
  def _split_generators(self, dl_manager):
 
 
 
 
 
 
73
  data = dl_manager.download_and_extract(_URLS['data'])
74
  labels = dl_manager.download_and_extract(_URLS['labels'])
75
  if self.config.name == "full":
76
  return [
77
  datasets.SplitGenerator(
78
  name=datasets.Split.TRAIN,
 
79
  gen_kwargs={
80
  "data": data,
81
  "labels": labels,
 
89
  return [
90
  datasets.SplitGenerator(
91
  name=datasets.Split.TRAIN,
 
92
  gen_kwargs={
93
  "data": data,
94
  "labels": labels,
 
98
  ),
99
  datasets.SplitGenerator(
100
  name=datasets.Split.TEST,
 
101
  gen_kwargs={
102
  "data": data,
103
  "labels": labels,
 
107
  ),
108
  ]
109
 
 
110
  def _generate_examples(self, data, labels, fold, split):
 
 
111
  X = np.load(data)
112
  y = np.load(labels)
113
  if self.config.name == "full":