Datasets:
Upload 4 files
Browse files- README.md +32 -1
- clean1.data +0 -0
- clean2.data +0 -0
- musk.py +286 -0
README.md
CHANGED
@@ -1,3 +1,34 @@
|
|
1 |
---
|
2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
+
language:
|
3 |
+
- en
|
4 |
+
tags:
|
5 |
+
- musk
|
6 |
+
- tabular_classification
|
7 |
+
- binary_classification
|
8 |
+
- multiclass_classification
|
9 |
+
pretty_name: Musk
|
10 |
+
size_categories:
|
11 |
+
- 10K<n<100K
|
12 |
+
task_categories: # Full list at https://github.com/huggingface/hub-docs/blob/main/js/src/lib/interfaces/Types.ts
|
13 |
+
- tabular-classification
|
14 |
+
configs:
|
15 |
+
- musk1
|
16 |
+
- musk2
|
17 |
---
|
18 |
+
# Musk
|
19 |
+
The [Musk dataset](https://archive.ics.uci.edu/ml/datasets/Musk) from the [UCI ML repository](https://archive.ics.uci.edu/ml/datasets).
|
20 |
+
Census dataset including personal characteristic of a person, and their income threshold.
|
21 |
+
|
22 |
+
# Configurations and tasks
|
23 |
+
| **Configuration** | **Task** | **Description** |
|
24 |
+
|-------------------|---------------------------|------------------------|
|
25 |
+
| musk1 | Binary classification | Is the molecule a musk?|
|
26 |
+
| musk2 | Binary classification | Is the molecule a musk?|
|
27 |
+
|
28 |
+
|
29 |
+
# Usage
|
30 |
+
```python
|
31 |
+
from datasets import load_dataset
|
32 |
+
|
33 |
+
dataset = load_dataset("mstz/musk", "musk1")["train"]
|
34 |
+
```
|
clean1.data
ADDED
The diff for this file is too large to render.
See raw diff
|
|
clean2.data
ADDED
The diff for this file is too large to render.
See raw diff
|
|
musk.py
ADDED
@@ -0,0 +1,286 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""Musk: A Census 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 |
+
_BASE_FEATURE_NAMES = [
|
13 |
+
"name",
|
14 |
+
"conformation_name",
|
15 |
+
"ray_0",
|
16 |
+
"ray_1",
|
17 |
+
"ray_2",
|
18 |
+
"ray_3",
|
19 |
+
"ray_4",
|
20 |
+
"ray_5",
|
21 |
+
"ray_6",
|
22 |
+
"ray_7",
|
23 |
+
"ray_8",
|
24 |
+
"ray_9",
|
25 |
+
"ray_10",
|
26 |
+
"ray_11",
|
27 |
+
"ray_12",
|
28 |
+
"ray_13",
|
29 |
+
"ray_14",
|
30 |
+
"ray_15",
|
31 |
+
"ray_16",
|
32 |
+
"ray_17",
|
33 |
+
"ray_18",
|
34 |
+
"ray_19",
|
35 |
+
"ray_20",
|
36 |
+
"ray_21",
|
37 |
+
"ray_22",
|
38 |
+
"ray_23",
|
39 |
+
"ray_24",
|
40 |
+
"ray_25",
|
41 |
+
"ray_26",
|
42 |
+
"ray_27",
|
43 |
+
"ray_28",
|
44 |
+
"ray_29",
|
45 |
+
"ray_30",
|
46 |
+
"ray_31",
|
47 |
+
"ray_32",
|
48 |
+
"ray_33",
|
49 |
+
"ray_34",
|
50 |
+
"ray_35",
|
51 |
+
"ray_36",
|
52 |
+
"ray_37",
|
53 |
+
"ray_38",
|
54 |
+
"ray_39",
|
55 |
+
"ray_40",
|
56 |
+
"ray_41",
|
57 |
+
"ray_42",
|
58 |
+
"ray_43",
|
59 |
+
"ray_44",
|
60 |
+
"ray_45",
|
61 |
+
"ray_46",
|
62 |
+
"ray_47",
|
63 |
+
"ray_48",
|
64 |
+
"ray_49",
|
65 |
+
"ray_50",
|
66 |
+
"ray_51",
|
67 |
+
"ray_52",
|
68 |
+
"ray_53",
|
69 |
+
"ray_54",
|
70 |
+
"ray_55",
|
71 |
+
"ray_56",
|
72 |
+
"ray_57",
|
73 |
+
"ray_58",
|
74 |
+
"ray_59",
|
75 |
+
"ray_60",
|
76 |
+
"ray_61",
|
77 |
+
"oxy_distance",
|
78 |
+
"displacement_1",
|
79 |
+
"displacement_2",
|
80 |
+
"displacement_3",
|
81 |
+
"is_musk"
|
82 |
+
]
|
83 |
+
|
84 |
+
DESCRIPTION = "Musk dataset from the UCI ML repository."
|
85 |
+
_HOMEPAGE = "https://archive.ics.uci.edu/ml/datasets/Musk"
|
86 |
+
_URLS = ("https://huggingface.co/datasets/mstz/musk/raw/musk.csv")
|
87 |
+
_CITATION = """
|
88 |
+
@misc{misc_musk_(version_1)_74,
|
89 |
+
author = {Chapman,David & Jain,Ajay},
|
90 |
+
title = {{Musk (Version 1)}},
|
91 |
+
year = {1994},
|
92 |
+
howpublished = {UCI Machine Learning Repository},
|
93 |
+
note = {{DOI}: \\url{10.24432/C5ZK5B}}
|
94 |
+
}"""
|
95 |
+
|
96 |
+
# Dataset info
|
97 |
+
urls_per_split = {
|
98 |
+
"musk1": {
|
99 |
+
"train": "https://huggingface.co/datasets/mstz/musk/raw/main/clean1.data"
|
100 |
+
},
|
101 |
+
"musk2": {
|
102 |
+
"train": "https://huggingface.co/datasets/mstz/musk/raw/main/clean2.data"
|
103 |
+
}
|
104 |
+
}
|
105 |
+
features_types_per_config = {
|
106 |
+
"musk1": {
|
107 |
+
"ray_0": datasets.Value("float64"),
|
108 |
+
"ray_1": datasets.Value("float64"),
|
109 |
+
"ray_2": datasets.Value("float64"),
|
110 |
+
"ray_3": datasets.Value("float64"),
|
111 |
+
"ray_4": datasets.Value("float64"),
|
112 |
+
"ray_5": datasets.Value("float64"),
|
113 |
+
"ray_6": datasets.Value("float64"),
|
114 |
+
"ray_7": datasets.Value("float64"),
|
115 |
+
"ray_8": datasets.Value("float64"),
|
116 |
+
"ray_9": datasets.Value("float64"),
|
117 |
+
"ray_10": datasets.Value("float64"),
|
118 |
+
"ray_11": datasets.Value("float64"),
|
119 |
+
"ray_12": datasets.Value("float64"),
|
120 |
+
"ray_13": datasets.Value("float64"),
|
121 |
+
"ray_14": datasets.Value("float64"),
|
122 |
+
"ray_15": datasets.Value("float64"),
|
123 |
+
"ray_16": datasets.Value("float64"),
|
124 |
+
"ray_17": datasets.Value("float64"),
|
125 |
+
"ray_18": datasets.Value("float64"),
|
126 |
+
"ray_19": datasets.Value("float64"),
|
127 |
+
"ray_20": datasets.Value("float64"),
|
128 |
+
"ray_21": datasets.Value("float64"),
|
129 |
+
"ray_22": datasets.Value("float64"),
|
130 |
+
"ray_23": datasets.Value("float64"),
|
131 |
+
"ray_24": datasets.Value("float64"),
|
132 |
+
"ray_25": datasets.Value("float64"),
|
133 |
+
"ray_26": datasets.Value("float64"),
|
134 |
+
"ray_27": datasets.Value("float64"),
|
135 |
+
"ray_28": datasets.Value("float64"),
|
136 |
+
"ray_29": datasets.Value("float64"),
|
137 |
+
"ray_30": datasets.Value("float64"),
|
138 |
+
"ray_31": datasets.Value("float64"),
|
139 |
+
"ray_32": datasets.Value("float64"),
|
140 |
+
"ray_33": datasets.Value("float64"),
|
141 |
+
"ray_34": datasets.Value("float64"),
|
142 |
+
"ray_35": datasets.Value("float64"),
|
143 |
+
"ray_36": datasets.Value("float64"),
|
144 |
+
"ray_37": datasets.Value("float64"),
|
145 |
+
"ray_38": datasets.Value("float64"),
|
146 |
+
"ray_39": datasets.Value("float64"),
|
147 |
+
"ray_40": datasets.Value("float64"),
|
148 |
+
"ray_41": datasets.Value("float64"),
|
149 |
+
"ray_42": datasets.Value("float64"),
|
150 |
+
"ray_43": datasets.Value("float64"),
|
151 |
+
"ray_44": datasets.Value("float64"),
|
152 |
+
"ray_45": datasets.Value("float64"),
|
153 |
+
"ray_46": datasets.Value("float64"),
|
154 |
+
"ray_47": datasets.Value("float64"),
|
155 |
+
"ray_48": datasets.Value("float64"),
|
156 |
+
"ray_49": datasets.Value("float64"),
|
157 |
+
"ray_50": datasets.Value("float64"),
|
158 |
+
"ray_51": datasets.Value("float64"),
|
159 |
+
"ray_52": datasets.Value("float64"),
|
160 |
+
"ray_53": datasets.Value("float64"),
|
161 |
+
"ray_54": datasets.Value("float64"),
|
162 |
+
"ray_55": datasets.Value("float64"),
|
163 |
+
"ray_56": datasets.Value("float64"),
|
164 |
+
"ray_57": datasets.Value("float64"),
|
165 |
+
"ray_58": datasets.Value("float64"),
|
166 |
+
"ray_59": datasets.Value("float64"),
|
167 |
+
"ray_60": datasets.Value("float64"),
|
168 |
+
"ray_61": datasets.Value("float64"),
|
169 |
+
"oxy_distance": datasets.Value("float64"),
|
170 |
+
"displacement_1": datasets.Value("float64"),
|
171 |
+
"displacement_2": datasets.Value("float64"),
|
172 |
+
"displacement_3": datasets.Value("float64"),
|
173 |
+
"is_musk": datasets.ClassLabel(num_classes=2, names=("no", "yes"))
|
174 |
+
},
|
175 |
+
"musk2": {
|
176 |
+
"ray_0": datasets.Value("float64"),
|
177 |
+
"ray_1": datasets.Value("float64"),
|
178 |
+
"ray_2": datasets.Value("float64"),
|
179 |
+
"ray_3": datasets.Value("float64"),
|
180 |
+
"ray_4": datasets.Value("float64"),
|
181 |
+
"ray_5": datasets.Value("float64"),
|
182 |
+
"ray_6": datasets.Value("float64"),
|
183 |
+
"ray_7": datasets.Value("float64"),
|
184 |
+
"ray_8": datasets.Value("float64"),
|
185 |
+
"ray_9": datasets.Value("float64"),
|
186 |
+
"ray_10": datasets.Value("float64"),
|
187 |
+
"ray_11": datasets.Value("float64"),
|
188 |
+
"ray_12": datasets.Value("float64"),
|
189 |
+
"ray_13": datasets.Value("float64"),
|
190 |
+
"ray_14": datasets.Value("float64"),
|
191 |
+
"ray_15": datasets.Value("float64"),
|
192 |
+
"ray_16": datasets.Value("float64"),
|
193 |
+
"ray_17": datasets.Value("float64"),
|
194 |
+
"ray_18": datasets.Value("float64"),
|
195 |
+
"ray_19": datasets.Value("float64"),
|
196 |
+
"ray_20": datasets.Value("float64"),
|
197 |
+
"ray_21": datasets.Value("float64"),
|
198 |
+
"ray_22": datasets.Value("float64"),
|
199 |
+
"ray_23": datasets.Value("float64"),
|
200 |
+
"ray_24": datasets.Value("float64"),
|
201 |
+
"ray_25": datasets.Value("float64"),
|
202 |
+
"ray_26": datasets.Value("float64"),
|
203 |
+
"ray_27": datasets.Value("float64"),
|
204 |
+
"ray_28": datasets.Value("float64"),
|
205 |
+
"ray_29": datasets.Value("float64"),
|
206 |
+
"ray_30": datasets.Value("float64"),
|
207 |
+
"ray_31": datasets.Value("float64"),
|
208 |
+
"ray_32": datasets.Value("float64"),
|
209 |
+
"ray_33": datasets.Value("float64"),
|
210 |
+
"ray_34": datasets.Value("float64"),
|
211 |
+
"ray_35": datasets.Value("float64"),
|
212 |
+
"ray_36": datasets.Value("float64"),
|
213 |
+
"ray_37": datasets.Value("float64"),
|
214 |
+
"ray_38": datasets.Value("float64"),
|
215 |
+
"ray_39": datasets.Value("float64"),
|
216 |
+
"ray_40": datasets.Value("float64"),
|
217 |
+
"ray_41": datasets.Value("float64"),
|
218 |
+
"ray_42": datasets.Value("float64"),
|
219 |
+
"ray_43": datasets.Value("float64"),
|
220 |
+
"ray_44": datasets.Value("float64"),
|
221 |
+
"ray_45": datasets.Value("float64"),
|
222 |
+
"ray_46": datasets.Value("float64"),
|
223 |
+
"ray_47": datasets.Value("float64"),
|
224 |
+
"ray_48": datasets.Value("float64"),
|
225 |
+
"ray_49": datasets.Value("float64"),
|
226 |
+
"ray_50": datasets.Value("float64"),
|
227 |
+
"ray_51": datasets.Value("float64"),
|
228 |
+
"ray_52": datasets.Value("float64"),
|
229 |
+
"ray_53": datasets.Value("float64"),
|
230 |
+
"ray_54": datasets.Value("float64"),
|
231 |
+
"ray_55": datasets.Value("float64"),
|
232 |
+
"ray_56": datasets.Value("float64"),
|
233 |
+
"ray_57": datasets.Value("float64"),
|
234 |
+
"ray_58": datasets.Value("float64"),
|
235 |
+
"ray_59": datasets.Value("float64"),
|
236 |
+
"ray_60": datasets.Value("float64"),
|
237 |
+
"ray_61": datasets.Value("float64"),
|
238 |
+
"oxy_distance": datasets.Value("float64"),
|
239 |
+
"displacement_1": datasets.Value("float64"),
|
240 |
+
"displacement_2": datasets.Value("float64"),
|
241 |
+
"displacement_3": datasets.Value("float64"),
|
242 |
+
"is_musk": datasets.ClassLabel(num_classes=2, names=("no", "yes"))
|
243 |
+
}
|
244 |
+
}
|
245 |
+
features_per_config = {k: datasets.Features(features_types_per_config[k]) for k in features_types_per_config}
|
246 |
+
|
247 |
+
|
248 |
+
class MuskConfig(datasets.BuilderConfig):
|
249 |
+
def __init__(self, **kwargs):
|
250 |
+
super(MuskConfig, self).__init__(version=VERSION, **kwargs)
|
251 |
+
self.features = features_per_config[kwargs["name"]]
|
252 |
+
|
253 |
+
|
254 |
+
class Musk(datasets.GeneratorBasedBuilder):
|
255 |
+
# dataset versions
|
256 |
+
DEFAULT_CONFIG = "musk1"
|
257 |
+
BUILDER_CONFIGS = [
|
258 |
+
MuskConfig(name="musk1",
|
259 |
+
description="Musk for binary classification."),
|
260 |
+
MuskConfig(name="musk2",
|
261 |
+
description="Musk for binary classification."),
|
262 |
+
]
|
263 |
+
|
264 |
+
|
265 |
+
def _info(self):
|
266 |
+
info = datasets.DatasetInfo(description=DESCRIPTION, citation=_CITATION, homepage=_HOMEPAGE,
|
267 |
+
features=features_per_config[self.config.name])
|
268 |
+
|
269 |
+
return info
|
270 |
+
|
271 |
+
def _split_generators(self, dl_manager: datasets.DownloadManager) -> List[datasets.SplitGenerator]:
|
272 |
+
downloads = dl_manager.download_and_extract(urls_per_split)
|
273 |
+
|
274 |
+
return [
|
275 |
+
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloads["train"]})
|
276 |
+
]
|
277 |
+
|
278 |
+
def _generate_examples(self, filepath: str):
|
279 |
+
data = pandas.read_csv(filepath)
|
280 |
+
data = data.drop("name", axis="columns", inplace=True)
|
281 |
+
data = data.drop("conformation_name", axis="columns", inplace=True)
|
282 |
+
|
283 |
+
for row_id, row in data.iterrows():
|
284 |
+
data_row = dict(row)
|
285 |
+
|
286 |
+
yield row_id, data_row
|