mstz commited on
Commit
ef18f6d
·
1 Parent(s): 5681b3a

updated to datasets 4.*

Browse files
README.md CHANGED
@@ -1,20 +1,40 @@
1
  ---
2
- language:
3
- - en
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  tags:
5
- - wall_following
6
  - tabular_classification
7
  - binary_classification
8
  - multiclass_classification
9
- - UCI
10
- pretty_name: WallFollowing
11
- size_categories:
12
- - 1K<n<5K
13
  task_categories:
14
  - tabular-classification
15
- configs:
16
- - wall_following
17
- license: cc
18
  ---
19
  # WallFollowing
20
  The [WallFollowing dataset](https://archive-beta.ics.uci.edu/dataset/194/wall+following+robot+navigation+data) from the [UCI repository](https://archive-beta.ics.uci.edu/).
 
1
  ---
2
+ configs:
3
+ - config_name: wall_following_0
4
+ data_files:
5
+ - path: wall_following_0/train.csv
6
+ split: train
7
+ default: true
8
+ - config_name: wall_following_1
9
+ data_files:
10
+ - path: wall_following_1/train.csv
11
+ split: train
12
+ default: false
13
+ - config_name: wall_following_2
14
+ data_files:
15
+ - path: wall_following_2/train.csv
16
+ split: train
17
+ default: false
18
+ - config_name: wall_following_3
19
+ data_files:
20
+ - path: wall_following_3/train.csv
21
+ split: train
22
+ default: false
23
+ - config_name: wall_following
24
+ data_files:
25
+ - path: wall_following/train.csv
26
+ split: train
27
+ default: false
28
+ language: en
29
+ license: cc
30
+ pretty_name: Wall following
31
+ size_categories: 1M<n<10M
32
  tags:
 
33
  - tabular_classification
34
  - binary_classification
35
  - multiclass_classification
 
 
 
 
36
  task_categories:
37
  - tabular-classification
 
 
 
38
  ---
39
  # WallFollowing
40
  The [WallFollowing dataset](https://archive-beta.ics.uci.edu/dataset/194/wall+following+robot+navigation+data) from the [UCI repository](https://archive-beta.ics.uci.edu/).
wall_following.csv DELETED
The diff for this file is too large to render. See raw diff
 
wall_following.py DELETED
@@ -1,232 +0,0 @@
1
- """WallFollowing Dataset"""
2
-
3
- from typing import List
4
- from functools import partial
5
-
6
- import datasets
7
-
8
- import pandas
9
-
10
-
11
- VERSION = datasets.Version("1.0.0")
12
-
13
- _ENCODING_DICS = {}
14
-
15
- DESCRIPTION = "WallFollowing dataset."
16
- _HOMEPAGE = "https://archive-beta.ics.uci.edu/dataset/194/wall+following+robot+navigation+data"
17
- _URLS = ("https://archive-beta.ics.uci.edu/dataset/194/wall+following+robot+navigation+data")
18
- _CITATION = """
19
- @misc{misc_wall-following_robot_navigation_data_194,
20
- author = {Freire,Ananda, Veloso,Marcus & Barreto,Guilherme},
21
- title = {{Wall-Following Robot Navigation Data}},
22
- year = {2010},
23
- howpublished = {UCI Machine Learning Repository},
24
- note = {{DOI}: \\url{10.24432/C57C8W}}
25
- }
26
- """
27
-
28
- # Dataset info
29
- urls_per_split = {
30
- "train": "https://huggingface.co/datasets/mstz/wall_following/raw/main/wall_following.csv"
31
- }
32
- features_types_per_config = {
33
- "wall_following": {
34
- "US1": datasets.Value("float64"),
35
- "US2": datasets.Value("float64"),
36
- "US3": datasets.Value("float64"),
37
- "US4": datasets.Value("float64"),
38
- "US5": datasets.Value("float64"),
39
- "US6": datasets.Value("float64"),
40
- "US7": datasets.Value("float64"),
41
- "US8": datasets.Value("float64"),
42
- "US9": datasets.Value("float64"),
43
- "US10": datasets.Value("float64"),
44
- "US11": datasets.Value("float64"),
45
- "US12": datasets.Value("float64"),
46
- "US13": datasets.Value("float64"),
47
- "US14": datasets.Value("float64"),
48
- "US15": datasets.Value("float64"),
49
- "US16": datasets.Value("float64"),
50
- "US17": datasets.Value("float64"),
51
- "US18": datasets.Value("float64"),
52
- "US19": datasets.Value("float64"),
53
- "US20": datasets.Value("float64"),
54
- "US21": datasets.Value("float64"),
55
- "US22": datasets.Value("float64"),
56
- "US23": datasets.Value("float64"),
57
- "US24": datasets.Value("float64"),
58
- "class": datasets.ClassLabel(num_classes=4),
59
- },
60
- "wall_following_0": {
61
- "US1": datasets.Value("float64"),
62
- "US2": datasets.Value("float64"),
63
- "US3": datasets.Value("float64"),
64
- "US4": datasets.Value("float64"),
65
- "US5": datasets.Value("float64"),
66
- "US6": datasets.Value("float64"),
67
- "US7": datasets.Value("float64"),
68
- "US8": datasets.Value("float64"),
69
- "US9": datasets.Value("float64"),
70
- "US10": datasets.Value("float64"),
71
- "US11": datasets.Value("float64"),
72
- "US12": datasets.Value("float64"),
73
- "US13": datasets.Value("float64"),
74
- "US14": datasets.Value("float64"),
75
- "US15": datasets.Value("float64"),
76
- "US16": datasets.Value("float64"),
77
- "US17": datasets.Value("float64"),
78
- "US18": datasets.Value("float64"),
79
- "US19": datasets.Value("float64"),
80
- "US20": datasets.Value("float64"),
81
- "US21": datasets.Value("float64"),
82
- "US22": datasets.Value("float64"),
83
- "US23": datasets.Value("float64"),
84
- "US24": datasets.Value("float64"),
85
- "class": datasets.ClassLabel(num_classes=2),
86
- },
87
- "wall_following_1": {
88
- "US1": datasets.Value("float64"),
89
- "US2": datasets.Value("float64"),
90
- "US3": datasets.Value("float64"),
91
- "US4": datasets.Value("float64"),
92
- "US5": datasets.Value("float64"),
93
- "US6": datasets.Value("float64"),
94
- "US7": datasets.Value("float64"),
95
- "US8": datasets.Value("float64"),
96
- "US9": datasets.Value("float64"),
97
- "US10": datasets.Value("float64"),
98
- "US11": datasets.Value("float64"),
99
- "US12": datasets.Value("float64"),
100
- "US13": datasets.Value("float64"),
101
- "US14": datasets.Value("float64"),
102
- "US15": datasets.Value("float64"),
103
- "US16": datasets.Value("float64"),
104
- "US17": datasets.Value("float64"),
105
- "US18": datasets.Value("float64"),
106
- "US19": datasets.Value("float64"),
107
- "US20": datasets.Value("float64"),
108
- "US21": datasets.Value("float64"),
109
- "US22": datasets.Value("float64"),
110
- "US23": datasets.Value("float64"),
111
- "US24": datasets.Value("float64"),
112
- "class": datasets.ClassLabel(num_classes=2),
113
- },
114
- "wall_following_2": {
115
- "US1": datasets.Value("float64"),
116
- "US2": datasets.Value("float64"),
117
- "US3": datasets.Value("float64"),
118
- "US4": datasets.Value("float64"),
119
- "US5": datasets.Value("float64"),
120
- "US6": datasets.Value("float64"),
121
- "US7": datasets.Value("float64"),
122
- "US8": datasets.Value("float64"),
123
- "US9": datasets.Value("float64"),
124
- "US10": datasets.Value("float64"),
125
- "US11": datasets.Value("float64"),
126
- "US12": datasets.Value("float64"),
127
- "US13": datasets.Value("float64"),
128
- "US14": datasets.Value("float64"),
129
- "US15": datasets.Value("float64"),
130
- "US16": datasets.Value("float64"),
131
- "US17": datasets.Value("float64"),
132
- "US18": datasets.Value("float64"),
133
- "US19": datasets.Value("float64"),
134
- "US20": datasets.Value("float64"),
135
- "US21": datasets.Value("float64"),
136
- "US22": datasets.Value("float64"),
137
- "US23": datasets.Value("float64"),
138
- "US24": datasets.Value("float64"),
139
- "class": datasets.ClassLabel(num_classes=2),
140
- },
141
- "wall_following_3": {
142
- "US1": datasets.Value("float64"),
143
- "US2": datasets.Value("float64"),
144
- "US3": datasets.Value("float64"),
145
- "US4": datasets.Value("float64"),
146
- "US5": datasets.Value("float64"),
147
- "US6": datasets.Value("float64"),
148
- "US7": datasets.Value("float64"),
149
- "US8": datasets.Value("float64"),
150
- "US9": datasets.Value("float64"),
151
- "US10": datasets.Value("float64"),
152
- "US11": datasets.Value("float64"),
153
- "US12": datasets.Value("float64"),
154
- "US13": datasets.Value("float64"),
155
- "US14": datasets.Value("float64"),
156
- "US15": datasets.Value("float64"),
157
- "US16": datasets.Value("float64"),
158
- "US17": datasets.Value("float64"),
159
- "US18": datasets.Value("float64"),
160
- "US19": datasets.Value("float64"),
161
- "US20": datasets.Value("float64"),
162
- "US21": datasets.Value("float64"),
163
- "US22": datasets.Value("float64"),
164
- "US23": datasets.Value("float64"),
165
- "US24": datasets.Value("float64"),
166
- "class": datasets.ClassLabel(num_classes=2),
167
- }
168
- }
169
- features_per_config = {k: datasets.Features(features_types_per_config[k]) for k in features_types_per_config}
170
-
171
-
172
- class WallFollowingConfig(datasets.BuilderConfig):
173
- def __init__(self, **kwargs):
174
- super(WallFollowingConfig, self).__init__(version=VERSION, **kwargs)
175
- self.features = features_per_config[kwargs["name"]]
176
-
177
-
178
- class WallFollowing(datasets.GeneratorBasedBuilder):
179
- # dataset versions
180
- DEFAULT_CONFIG = "wall_following"
181
- BUILDER_CONFIGS = [
182
- WallFollowingConfig(name="wall_following", description="WallFollowing for multiclass classification."),
183
- WallFollowingConfig(name="wall_following_0", description="WallFollowing for binary classification."),
184
- WallFollowingConfig(name="wall_following_1", description="WallFollowing for binary classification."),
185
- WallFollowingConfig(name="wall_following_2", description="WallFollowing for binary classification."),
186
- WallFollowingConfig(name="wall_following_3", description="WallFollowing for binary classification."),
187
-
188
- ]
189
-
190
-
191
- def _info(self):
192
- info = datasets.DatasetInfo(description=DESCRIPTION, citation=_CITATION, homepage=_HOMEPAGE,
193
- features=features_per_config[self.config.name])
194
-
195
- return info
196
-
197
- def _split_generators(self, dl_manager: datasets.DownloadManager) -> List[datasets.SplitGenerator]:
198
- downloads = dl_manager.download_and_extract(urls_per_split)
199
-
200
- return [
201
- datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloads["train"]}),
202
- ]
203
-
204
- def _generate_examples(self, filepath: str):
205
- data = pandas.read_csv(filepath)
206
- data = self.preprocess(data)
207
-
208
- for row_id, row in data.iterrows():
209
- data_row = dict(row)
210
-
211
- yield row_id, data_row
212
-
213
- def preprocess(self, data: pandas.DataFrame) -> pandas.DataFrame:
214
- if self.config.name == "wall_following_0":
215
- data["class"] = data["class"].apply(lambda x: 1 if x == 0 else 0)
216
- elif self.config.name == "wall_following_1":
217
- data["class"] = data["class"].apply(lambda x: 1 if x == 1 else 0)
218
- elif self.config.name == "wall_following_2":
219
- data["class"] = data["class"].apply(lambda x: 1 if x == 2 else 0)
220
- elif self.config.name == "wall_following_3":
221
- data["class"] = data["class"].apply(lambda x: 1 if x == 3 else 0)
222
-
223
- for feature in _ENCODING_DICS:
224
- encoding_function = partial(self.encode, feature)
225
- data.loc[:, feature] = data[feature].apply(encoding_function)
226
-
227
- return data[list(features_types_per_config[self.config.name].keys())]
228
-
229
- def encode(self, feature, value):
230
- if feature in _ENCODING_DICS:
231
- return _ENCODING_DICS[feature][value]
232
- raise ValueError(f"Unknown feature: {feature}")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
wall_following/train.csv ADDED
The diff for this file is too large to render. See raw diff
 
wall_following_0/train.csv ADDED
The diff for this file is too large to render. See raw diff
 
wall_following_1/train.csv ADDED
The diff for this file is too large to render. See raw diff
 
wall_following_2/train.csv ADDED
The diff for this file is too large to render. See raw diff
 
wall_following_3/train.csv ADDED
The diff for this file is too large to render. See raw diff