Datasets:
Upload 3 files
Browse files- README.md +29 -1
- haberman.data +307 -0
- haberman.py +72 -0
README.md
CHANGED
@@ -1,3 +1,31 @@
|
|
1 |
---
|
2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
+
language:
|
3 |
+
- en
|
4 |
+
tags:
|
5 |
+
- haberman
|
6 |
+
- tabular_classification
|
7 |
+
- binary_classification
|
8 |
+
- multiclass_classification
|
9 |
+
pretty_name: Haberman
|
10 |
+
size_categories:
|
11 |
+
- 100<n<1K
|
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 |
+
- survival
|
16 |
---
|
17 |
+
# Haberman
|
18 |
+
The [Haberman dataset](https://archive.ics.uci.edu/ml/datasets/Haberman) from the [UCI ML repository](https://archive.ics.uci.edu/ml/datasets).
|
19 |
+
Has the patient survived surgery?
|
20 |
+
|
21 |
+
# Configurations and tasks
|
22 |
+
| **Configuration** | **Task** | **Description** |
|
23 |
+
|-------------------|---------------------------|------------------------------------|
|
24 |
+
| sruvival | Binary classification | Has the patient survived surgery? |
|
25 |
+
|
26 |
+
# Usage
|
27 |
+
```python
|
28 |
+
from datasets import load_dataset
|
29 |
+
|
30 |
+
dataset = load_dataset("mstz/haberman", "survival")["train"]
|
31 |
+
```
|
haberman.data
ADDED
@@ -0,0 +1,307 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
1 |
+
age,year_of_operation,number_of_axillary_nodes,has_survived_5_years
|
2 |
+
30,1964,1,1
|
3 |
+
30,1962,3,1
|
4 |
+
30,1965,0,1
|
5 |
+
31,1959,2,1
|
6 |
+
31,1965,4,1
|
7 |
+
33,1958,10,1
|
8 |
+
33,1960,0,1
|
9 |
+
34,1959,0,0
|
10 |
+
34,1966,9,0
|
11 |
+
34,1958,30,1
|
12 |
+
34,1960,1,1
|
13 |
+
34,1961,10,1
|
14 |
+
34,1967,7,1
|
15 |
+
34,1960,0,1
|
16 |
+
35,1964,13,1
|
17 |
+
35,1963,0,1
|
18 |
+
36,1960,1,1
|
19 |
+
36,1969,0,1
|
20 |
+
37,1960,0,1
|
21 |
+
37,1963,0,1
|
22 |
+
37,1958,0,1
|
23 |
+
37,1959,6,1
|
24 |
+
37,1960,15,1
|
25 |
+
37,1963,0,1
|
26 |
+
38,1969,21,0
|
27 |
+
38,1959,2,1
|
28 |
+
38,1960,0,1
|
29 |
+
38,1960,0,1
|
30 |
+
38,1962,3,1
|
31 |
+
38,1964,1,1
|
32 |
+
38,1966,0,1
|
33 |
+
38,1966,11,1
|
34 |
+
38,1960,1,1
|
35 |
+
38,1967,5,1
|
36 |
+
39,1966,0,0
|
37 |
+
39,1963,0,1
|
38 |
+
39,1967,0,1
|
39 |
+
39,1958,0,1
|
40 |
+
39,1959,2,1
|
41 |
+
39,1963,4,1
|
42 |
+
40,1958,2,1
|
43 |
+
40,1958,0,1
|
44 |
+
40,1965,0,1
|
45 |
+
41,1960,23,0
|
46 |
+
41,1964,0,0
|
47 |
+
41,1967,0,0
|
48 |
+
41,1958,0,1
|
49 |
+
41,1959,8,1
|
50 |
+
41,1959,0,1
|
51 |
+
41,1964,0,1
|
52 |
+
41,1969,8,1
|
53 |
+
41,1965,0,1
|
54 |
+
41,1965,0,1
|
55 |
+
42,1969,1,0
|
56 |
+
42,1959,0,0
|
57 |
+
42,1958,0,1
|
58 |
+
42,1960,1,1
|
59 |
+
42,1959,2,1
|
60 |
+
42,1961,4,1
|
61 |
+
42,1962,20,1
|
62 |
+
42,1965,0,1
|
63 |
+
42,1963,1,1
|
64 |
+
43,1958,52,0
|
65 |
+
43,1959,2,0
|
66 |
+
43,1964,0,0
|
67 |
+
43,1964,0,0
|
68 |
+
43,1963,14,1
|
69 |
+
43,1964,2,1
|
70 |
+
43,1964,3,1
|
71 |
+
43,1960,0,1
|
72 |
+
43,1963,2,1
|
73 |
+
43,1965,0,1
|
74 |
+
43,1966,4,1
|
75 |
+
44,1964,6,0
|
76 |
+
44,1958,9,0
|
77 |
+
44,1963,19,0
|
78 |
+
44,1961,0,1
|
79 |
+
44,1963,1,1
|
80 |
+
44,1961,0,1
|
81 |
+
44,1967,16,1
|
82 |
+
45,1965,6,0
|
83 |
+
45,1966,0,0
|
84 |
+
45,1967,1,0
|
85 |
+
45,1960,0,1
|
86 |
+
45,1967,0,1
|
87 |
+
45,1959,14,1
|
88 |
+
45,1964,0,1
|
89 |
+
45,1968,0,1
|
90 |
+
45,1967,1,1
|
91 |
+
46,1958,2,0
|
92 |
+
46,1969,3,0
|
93 |
+
46,1962,5,0
|
94 |
+
46,1965,20,0
|
95 |
+
46,1962,0,1
|
96 |
+
46,1958,3,1
|
97 |
+
46,1963,0,1
|
98 |
+
47,1963,23,0
|
99 |
+
47,1962,0,0
|
100 |
+
47,1965,0,0
|
101 |
+
47,1961,0,1
|
102 |
+
47,1963,6,1
|
103 |
+
47,1966,0,1
|
104 |
+
47,1967,0,1
|
105 |
+
47,1958,3,1
|
106 |
+
47,1960,4,1
|
107 |
+
47,1968,4,1
|
108 |
+
47,1966,12,1
|
109 |
+
48,1958,11,0
|
110 |
+
48,1958,11,0
|
111 |
+
48,1967,7,0
|
112 |
+
48,1961,8,1
|
113 |
+
48,1962,2,1
|
114 |
+
48,1964,0,1
|
115 |
+
48,1966,0,1
|
116 |
+
49,1963,0,0
|
117 |
+
49,1964,10,0
|
118 |
+
49,1961,1,1
|
119 |
+
49,1962,0,1
|
120 |
+
49,1966,0,1
|
121 |
+
49,1960,1,1
|
122 |
+
49,1962,1,1
|
123 |
+
49,1963,3,1
|
124 |
+
49,1961,0,1
|
125 |
+
49,1967,1,1
|
126 |
+
50,1963,13,0
|
127 |
+
50,1964,0,0
|
128 |
+
50,1959,0,1
|
129 |
+
50,1961,6,1
|
130 |
+
50,1961,0,1
|
131 |
+
50,1963,1,1
|
132 |
+
50,1958,1,1
|
133 |
+
50,1959,2,1
|
134 |
+
50,1961,0,1
|
135 |
+
50,1964,0,1
|
136 |
+
50,1965,4,1
|
137 |
+
50,1966,1,1
|
138 |
+
51,1959,13,0
|
139 |
+
51,1959,3,0
|
140 |
+
51,1964,7,1
|
141 |
+
51,1959,1,1
|
142 |
+
51,1965,0,1
|
143 |
+
51,1966,1,1
|
144 |
+
52,1969,3,0
|
145 |
+
52,1959,2,0
|
146 |
+
52,1962,3,0
|
147 |
+
52,1966,4,0
|
148 |
+
52,1961,0,1
|
149 |
+
52,1963,4,1
|
150 |
+
52,1969,0,1
|
151 |
+
52,1960,4,1
|
152 |
+
52,1960,5,1
|
153 |
+
52,1962,0,1
|
154 |
+
52,1962,1,1
|
155 |
+
52,1964,0,1
|
156 |
+
52,1965,0,1
|
157 |
+
52,1968,0,1
|
158 |
+
53,1958,4,0
|
159 |
+
53,1965,1,0
|
160 |
+
53,1959,3,0
|
161 |
+
53,1960,9,0
|
162 |
+
53,1963,24,0
|
163 |
+
53,1965,12,0
|
164 |
+
53,1958,1,1
|
165 |
+
53,1960,1,1
|
166 |
+
53,1960,2,1
|
167 |
+
53,1961,1,1
|
168 |
+
53,1963,0,1
|
169 |
+
54,1960,11,0
|
170 |
+
54,1965,23,0
|
171 |
+
54,1965,5,0
|
172 |
+
54,1968,7,0
|
173 |
+
54,1959,7,1
|
174 |
+
54,1960,3,1
|
175 |
+
54,1966,0,1
|
176 |
+
54,1967,46,1
|
177 |
+
54,1962,0,1
|
178 |
+
54,1969,7,1
|
179 |
+
54,1963,19,1
|
180 |
+
54,1958,1,1
|
181 |
+
54,1962,0,1
|
182 |
+
55,1963,6,0
|
183 |
+
55,1968,15,0
|
184 |
+
55,1958,1,1
|
185 |
+
55,1958,0,1
|
186 |
+
55,1958,1,1
|
187 |
+
55,1966,18,1
|
188 |
+
55,1966,0,1
|
189 |
+
55,1969,3,1
|
190 |
+
55,1969,22,1
|
191 |
+
55,1967,1,1
|
192 |
+
56,1965,9,0
|
193 |
+
56,1966,3,0
|
194 |
+
56,1960,0,1
|
195 |
+
56,1966,2,1
|
196 |
+
56,1966,1,1
|
197 |
+
56,1967,0,1
|
198 |
+
56,1960,0,1
|
199 |
+
57,1961,5,0
|
200 |
+
57,1962,14,0
|
201 |
+
57,1964,1,0
|
202 |
+
57,1964,9,1
|
203 |
+
57,1969,0,1
|
204 |
+
57,1961,0,1
|
205 |
+
57,1962,0,1
|
206 |
+
57,1963,0,1
|
207 |
+
57,1964,0,1
|
208 |
+
57,1964,0,1
|
209 |
+
57,1967,0,1
|
210 |
+
58,1959,0,1
|
211 |
+
58,1960,3,1
|
212 |
+
58,1961,1,1
|
213 |
+
58,1967,0,1
|
214 |
+
58,1958,0,1
|
215 |
+
58,1958,3,1
|
216 |
+
58,1961,2,1
|
217 |
+
59,1962,35,0
|
218 |
+
59,1960,0,1
|
219 |
+
59,1963,0,1
|
220 |
+
59,1964,1,1
|
221 |
+
59,1964,4,1
|
222 |
+
59,1964,0,1
|
223 |
+
59,1964,7,1
|
224 |
+
59,1967,3,1
|
225 |
+
60,1959,17,0
|
226 |
+
60,1965,0,0
|
227 |
+
60,1961,1,1
|
228 |
+
60,1967,2,1
|
229 |
+
60,1961,25,1
|
230 |
+
60,1964,0,1
|
231 |
+
61,1962,5,0
|
232 |
+
61,1965,0,0
|
233 |
+
61,1968,1,0
|
234 |
+
61,1959,0,1
|
235 |
+
61,1959,0,1
|
236 |
+
61,1964,0,1
|
237 |
+
61,1965,8,1
|
238 |
+
61,1968,0,1
|
239 |
+
61,1959,0,1
|
240 |
+
62,1959,13,0
|
241 |
+
62,1958,0,0
|
242 |
+
62,1965,19,0
|
243 |
+
62,1962,6,1
|
244 |
+
62,1966,0,1
|
245 |
+
62,1966,0,1
|
246 |
+
62,1958,0,1
|
247 |
+
63,1960,1,0
|
248 |
+
63,1961,0,1
|
249 |
+
63,1962,0,1
|
250 |
+
63,1963,0,1
|
251 |
+
63,1963,0,1
|
252 |
+
63,1966,0,1
|
253 |
+
63,1961,9,1
|
254 |
+
63,1961,28,1
|
255 |
+
64,1958,0,1
|
256 |
+
64,1965,22,1
|
257 |
+
64,1966,0,1
|
258 |
+
64,1961,0,1
|
259 |
+
64,1968,0,1
|
260 |
+
65,1958,0,0
|
261 |
+
65,1961,2,0
|
262 |
+
65,1962,22,0
|
263 |
+
65,1966,15,0
|
264 |
+
65,1958,0,1
|
265 |
+
65,1964,0,1
|
266 |
+
65,1967,0,1
|
267 |
+
65,1959,2,1
|
268 |
+
65,1964,0,1
|
269 |
+
65,1967,1,1
|
270 |
+
66,1958,0,0
|
271 |
+
66,1961,13,0
|
272 |
+
66,1958,0,1
|
273 |
+
66,1958,1,1
|
274 |
+
66,1968,0,1
|
275 |
+
67,1964,8,0
|
276 |
+
67,1963,1,0
|
277 |
+
67,1966,0,1
|
278 |
+
67,1966,0,1
|
279 |
+
67,1961,0,1
|
280 |
+
67,1965,0,1
|
281 |
+
68,1967,0,1
|
282 |
+
68,1968,0,1
|
283 |
+
69,1967,8,0
|
284 |
+
69,1960,0,1
|
285 |
+
69,1965,0,1
|
286 |
+
69,1966,0,1
|
287 |
+
70,1958,0,0
|
288 |
+
70,1958,4,0
|
289 |
+
70,1966,14,1
|
290 |
+
70,1967,0,1
|
291 |
+
70,1968,0,1
|
292 |
+
70,1959,8,1
|
293 |
+
70,1963,0,1
|
294 |
+
71,1968,2,1
|
295 |
+
72,1963,0,0
|
296 |
+
72,1958,0,1
|
297 |
+
72,1964,0,1
|
298 |
+
72,1967,3,1
|
299 |
+
73,1962,0,1
|
300 |
+
73,1968,0,1
|
301 |
+
74,1965,3,0
|
302 |
+
74,1963,0,1
|
303 |
+
75,1962,1,1
|
304 |
+
76,1967,0,1
|
305 |
+
77,1965,3,1
|
306 |
+
78,1965,1,0
|
307 |
+
83,1958,2,0
|
haberman.py
ADDED
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""Haberman"""
|
2 |
+
|
3 |
+
from typing import List
|
4 |
+
|
5 |
+
import datasets
|
6 |
+
|
7 |
+
import pandas
|
8 |
+
|
9 |
+
|
10 |
+
VERSION = datasets.Version("1.0.0")
|
11 |
+
|
12 |
+
DESCRIPTION = "Haberman dataset from the UCI ML repository."
|
13 |
+
_HOMEPAGE = "https://archive.ics.uci.edu/ml/datasets/Haberman"
|
14 |
+
_URLS = ("https://archive.ics.uci.edu/ml/datasets/Haberman")
|
15 |
+
_CITATION = """
|
16 |
+
@misc{misc_haberman's_survival_43,
|
17 |
+
author = {Haberman,S.},
|
18 |
+
title = {{Haberman's Survival}},
|
19 |
+
year = {1999},
|
20 |
+
howpublished = {UCI Machine Learning Repository},
|
21 |
+
note = {{DOI}: \\url{10.24432/C5XK51}}
|
22 |
+
}"""
|
23 |
+
|
24 |
+
# Dataset info
|
25 |
+
urls_per_split = {
|
26 |
+
"train": "https://huggingface.co/datasets/mstz/haberman/raw/main/haberman.data"
|
27 |
+
}
|
28 |
+
features_types_per_config = {
|
29 |
+
"survival": {
|
30 |
+
"age": datasets.Value("int32"),
|
31 |
+
"year_of_operation": datasets.Value("int32"),
|
32 |
+
"number_of_axillary_nodes": datasets.Value("int32"),
|
33 |
+
"has_survived_5_years": datasets.ClassLabel(num_classes=2, names=("no", "yes"))
|
34 |
+
}
|
35 |
+
}
|
36 |
+
features_per_config = {k: datasets.Features(features_types_per_config[k]) for k in features_types_per_config}
|
37 |
+
|
38 |
+
|
39 |
+
class HabermanConfig(datasets.BuilderConfig):
|
40 |
+
def __init__(self, **kwargs):
|
41 |
+
super(HabermanConfig, self).__init__(version=VERSION, **kwargs)
|
42 |
+
self.features = features_per_config[kwargs["name"]]
|
43 |
+
|
44 |
+
|
45 |
+
class Haberman(datasets.GeneratorBasedBuilder):
|
46 |
+
# dataset versions
|
47 |
+
DEFAULT_CONFIG = "survival"
|
48 |
+
BUILDER_CONFIGS = [
|
49 |
+
HabermanConfig(name="survival",
|
50 |
+
description="Haberman for binary classification.")
|
51 |
+
]
|
52 |
+
|
53 |
+
def _info(self):
|
54 |
+
info = datasets.DatasetInfo(description=DESCRIPTION, citation=_CITATION, homepage=_HOMEPAGE,
|
55 |
+
features=features_per_config[self.config.name])
|
56 |
+
|
57 |
+
return info
|
58 |
+
|
59 |
+
def _split_generators(self, dl_manager: datasets.DownloadManager) -> List[datasets.SplitGenerator]:
|
60 |
+
downloads = dl_manager.download_and_extract(urls_per_split)
|
61 |
+
|
62 |
+
return [
|
63 |
+
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloads["train"]})
|
64 |
+
]
|
65 |
+
|
66 |
+
def _generate_examples(self, filepath: str):
|
67 |
+
data = pandas.read_csv(filepath)
|
68 |
+
|
69 |
+
for row_id, row in data.iterrows():
|
70 |
+
data_row = dict(row)
|
71 |
+
|
72 |
+
yield row_id, data_row
|