Datasets:
Upload 3 files
Browse files- README.md +37 -1
- hayes_roth.data +132 -0
- hayes_roth.py +119 -0
README.md
CHANGED
@@ -1,3 +1,39 @@
|
|
1 |
---
|
2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
+
language:
|
3 |
+
- en
|
4 |
+
tags:
|
5 |
+
- hayes
|
6 |
+
- tabular_classification
|
7 |
+
- binary_classification
|
8 |
+
- multiclass_classification
|
9 |
+
pretty_name: Hayes evaluation
|
10 |
+
size_categories:
|
11 |
+
- 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 |
+
- hayes
|
16 |
+
- hayes_1
|
17 |
+
- hayes_2
|
18 |
+
- hayes_3
|
19 |
+
|
20 |
---
|
21 |
+
# Hayes
|
22 |
+
The [Hayes-Roth dataset](https://archive-beta.ics.uci.edu/dataset/44/hayes+roth) from the [UCI repository](https://archive-beta.ics.uci.edu).
|
23 |
+
|
24 |
+
# Configurations and tasks
|
25 |
+
| **Configuration** | **Task** | **Description** |
|
26 |
+
|-------------------|---------------------------|--------------------------------|
|
27 |
+
| hayes | Multiclass classification | Classify hayes type. |
|
28 |
+
| hayes_1 | Binary classification | Is this instance of class 1? |
|
29 |
+
| hayes_2 | Binary classification | Is this instance of class 2? |
|
30 |
+
| hayes_3 | Binary classification | Is this instance of class 3? |
|
31 |
+
|
32 |
+
|
33 |
+
|
34 |
+
# Usage
|
35 |
+
```python
|
36 |
+
from datasets import load_dataset
|
37 |
+
|
38 |
+
dataset = load_dataset("mstz/hayes", "hayes")["train"]
|
39 |
+
```
|
hayes_roth.data
ADDED
@@ -0,0 +1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+
91,2,3,2,1,1
|
26 |
+
79,3,2,2,1,2
|
27 |
+
23,3,2,1,3,2
|
28 |
+
25,2,1,2,2,2
|
29 |
+
30,1,1,3,2,1
|
30 |
+
57,3,2,1,1,1
|
31 |
+
3,1,4,1,1,3
|
32 |
+
114,2,2,1,3,1
|
33 |
+
37,1,2,1,3,2
|
34 |
+
66,1,1,1,2,1
|
35 |
+
110,2,4,3,1,3
|
36 |
+
116,3,1,2,2,2
|
37 |
+
88,1,1,2,2,2
|
38 |
+
77,3,2,2,1,2
|
39 |
+
82,1,2,1,2,2
|
40 |
+
64,3,4,3,2,3
|
41 |
+
84,2,2,2,1,2
|
42 |
+
86,2,2,1,2,2
|
43 |
+
6,3,2,1,3,2
|
44 |
+
74,3,2,1,1,1
|
45 |
+
106,3,1,2,1,1
|
46 |
+
115,1,2,1,3,2
|
47 |
+
130,2,1,1,2,1
|
48 |
+
54,1,1,1,2,1
|
49 |
+
33,1,2,2,3,2
|
50 |
+
67,3,3,1,1,1
|
51 |
+
69,3,3,3,1,1
|
52 |
+
39,3,2,1,2,2
|
53 |
+
53,3,2,1,2,2
|
54 |
+
127,3,1,2,1,1
|
55 |
+
96,1,1,1,2,1
|
56 |
+
121,2,1,3,2,1
|
57 |
+
70,2,2,2,1,2
|
58 |
+
123,2,1,2,1,1
|
59 |
+
42,2,2,1,3,1
|
60 |
+
78,2,1,2,2,2
|
61 |
+
11,1,2,4,2,3
|
62 |
+
129,2,2,1,2,2
|
63 |
+
128,1,1,2,4,3
|
64 |
+
5,1,3,2,1,1
|
65 |
+
4,2,4,4,2,3
|
66 |
+
95,2,3,2,1,1
|
67 |
+
73,3,1,2,2,2
|
68 |
+
26,1,1,2,2,2
|
69 |
+
48,1,3,2,4,3
|
70 |
+
104,1,1,2,2,2
|
71 |
+
102,3,1,4,2,3
|
72 |
+
2,2,1,3,2,2
|
73 |
+
41,1,1,3,2,2
|
74 |
+
119,3,1,3,2,1
|
75 |
+
75,1,2,4,4,3
|
76 |
+
47,1,4,2,1,3
|
77 |
+
93,2,1,2,1,1
|
78 |
+
46,3,4,1,2,3
|
79 |
+
132,2,2,1,1,1
|
80 |
+
108,1,1,2,1,1
|
81 |
+
18,2,2,4,3,3
|
82 |
+
62,3,1,2,2,2
|
83 |
+
120,1,1,3,2,1
|
84 |
+
35,1,2,1,3,1
|
85 |
+
27,1,4,4,1,3
|
86 |
+
98,3,3,3,2,2
|
87 |
+
109,2,2,1,3,2
|
88 |
+
31,3,3,2,1,2
|
89 |
+
112,1,1,1,3,1
|
90 |
+
34,2,2,1,2,2
|
91 |
+
63,2,2,2,1,2
|
92 |
+
65,2,3,2,3,2
|
93 |
+
117,1,3,2,1,2
|
94 |
+
56,2,2,1,2,2
|
95 |
+
59,1,1,1,2,1
|
96 |
+
76,3,2,2,1,2
|
97 |
+
1,3,2,1,1,1
|
98 |
+
28,1,1,2,1,1
|
99 |
+
22,3,1,4,4,3
|
100 |
+
29,3,3,2,1,2
|
101 |
+
111,2,3,2,1,2
|
102 |
+
97,2,1,3,1,1
|
103 |
+
49,1,2,1,2,2
|
104 |
+
51,3,1,1,2,1
|
105 |
+
87,2,2,4,1,3
|
106 |
+
58,1,2,2,1,2
|
107 |
+
32,2,3,2,1,2
|
108 |
+
72,2,2,1,4,3
|
109 |
+
55,1,4,2,3,3
|
110 |
+
103,2,2,1,1,1
|
111 |
+
7,1,2,1,1,1
|
112 |
+
99,2,2,3,2,2
|
113 |
+
15,1,3,2,1,1
|
114 |
+
126,3,1,2,1,1
|
115 |
+
45,3,1,1,2,1
|
116 |
+
101,3,3,1,4,3
|
117 |
+
100,2,3,4,1,3
|
118 |
+
24,1,2,3,3,2
|
119 |
+
124,3,3,2,2,2
|
120 |
+
13,3,3,4,2,3
|
121 |
+
14,1,2,2,1,2
|
122 |
+
38,2,1,1,4,3
|
123 |
+
71,3,1,2,2,2
|
124 |
+
43,3,2,2,4,3
|
125 |
+
131,2,3,1,3,1
|
126 |
+
17,2,1,1,2,1
|
127 |
+
12,3,4,1,3,3
|
128 |
+
44,1,1,4,3,3
|
129 |
+
40,2,1,2,1,1
|
130 |
+
90,1,2,1,2,2
|
131 |
+
21,1,2,2,1,2
|
132 |
+
9,3,1,1,2,1
|
hayes_roth.py
ADDED
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from typing import List
|
2 |
+
from functools import partial
|
3 |
+
|
4 |
+
import datasets
|
5 |
+
|
6 |
+
import pandas
|
7 |
+
|
8 |
+
|
9 |
+
VERSION = datasets.Version("1.0.0")
|
10 |
+
|
11 |
+
|
12 |
+
DESCRIPTION = "Hayes efficiency dataset from the UCI repository."
|
13 |
+
_HOMEPAGE = "https://archive-beta.ics.uci.edu/dataset/242/hayes+efficiency"
|
14 |
+
_URLS = ("https://archive-beta.ics.uci.edu/dataset/30/hayes+method+choice")
|
15 |
+
_CITATION = """
|
16 |
+
@misc{misc_hayes_efficiency_242,
|
17 |
+
author = {Tsanas,Athanasios & Xifara,Angeliki},
|
18 |
+
title = {{Hayes efficiency}},
|
19 |
+
year = {2012},
|
20 |
+
howpublished = {UCI Machine Learning Repository},
|
21 |
+
note = {{DOI}: \\url{10.24432/C51307}}
|
22 |
+
}"""
|
23 |
+
|
24 |
+
# Dataset info
|
25 |
+
_BASE_FEATURE_NAMES = [
|
26 |
+
"name",
|
27 |
+
"hobby",
|
28 |
+
"age",
|
29 |
+
"educational_level",
|
30 |
+
"marital_level",
|
31 |
+
"class"
|
32 |
+
]
|
33 |
+
urls_per_split = {
|
34 |
+
"train": "https://huggingface.co/datasets/mstz/hayes/raw/main/hayes_roth.data"
|
35 |
+
}
|
36 |
+
features_types_per_config = {
|
37 |
+
"hayes": {
|
38 |
+
"hobby": datasets.Value("string"),
|
39 |
+
"age": datasets.Value("int8"),
|
40 |
+
"educational_level": datasets.Value("int8"),
|
41 |
+
"marital_level": datasets.Value("string"),
|
42 |
+
"class": datasets.ClassLabel(num_classes=3)
|
43 |
+
},
|
44 |
+
"hayes_1": {
|
45 |
+
"hobby": datasets.Value("string"),
|
46 |
+
"age": datasets.Value("int8"),
|
47 |
+
"educational_level": datasets.Value("int8"),
|
48 |
+
"marital_level": datasets.Value("string"),
|
49 |
+
"class": datasets.ClassLabel(num_classes=2)
|
50 |
+
},
|
51 |
+
"hayes_2": {
|
52 |
+
"hobby": datasets.Value("string"),
|
53 |
+
"age": datasets.Value("int8"),
|
54 |
+
"educational_level": datasets.Value("int8"),
|
55 |
+
"marital_level": datasets.Value("string"),
|
56 |
+
"class": datasets.ClassLabel(num_classes=2)
|
57 |
+
},
|
58 |
+
"hayes_3": {
|
59 |
+
"hobby": datasets.Value("string"),
|
60 |
+
"age": datasets.Value("int8"),
|
61 |
+
"educational_level": datasets.Value("int8"),
|
62 |
+
"marital_level": datasets.Value("string"),
|
63 |
+
"class": datasets.ClassLabel(num_classes=2)
|
64 |
+
}
|
65 |
+
}
|
66 |
+
features_per_config = {k: datasets.Features(features_types_per_config[k]) for k in features_types_per_config}
|
67 |
+
|
68 |
+
|
69 |
+
class HayesConfig(datasets.BuilderConfig):
|
70 |
+
def __init__(self, **kwargs):
|
71 |
+
super(HayesConfig, self).__init__(version=VERSION, **kwargs)
|
72 |
+
self.features = features_per_config[kwargs["name"]]
|
73 |
+
|
74 |
+
|
75 |
+
class Hayes(datasets.GeneratorBasedBuilder):
|
76 |
+
# dataset versions
|
77 |
+
DEFAULT_CONFIG = "hayes"
|
78 |
+
BUILDER_CONFIGS = [
|
79 |
+
HayesConfig(name="hayes", description="Hayes dataset."),
|
80 |
+
HayesConfig(name="hayes_1", description="Hayes for binary classification (is example of class 1?)."),
|
81 |
+
HayesConfig(name="hayes_2", description="Hayes for binary classification (is example of class 2?)."),
|
82 |
+
HayesConfig(name="hayes_3", description="Hayes for binary classification (is example of class 3?).")
|
83 |
+
]
|
84 |
+
|
85 |
+
|
86 |
+
def _info(self):
|
87 |
+
info = datasets.DatasetInfo(description=DESCRIPTION, citation=_CITATION, homepage=_HOMEPAGE,
|
88 |
+
features=features_per_config[self.config.name])
|
89 |
+
|
90 |
+
return info
|
91 |
+
|
92 |
+
def _split_generators(self, dl_manager: datasets.DownloadManager) -> List[datasets.SplitGenerator]:
|
93 |
+
downloads = dl_manager.download_and_extract(urls_per_split)
|
94 |
+
|
95 |
+
return [
|
96 |
+
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloads["train"]})
|
97 |
+
]
|
98 |
+
|
99 |
+
def _generate_examples(self, filepath: str):
|
100 |
+
data = pandas.read_csv(filepath, header=None)
|
101 |
+
data = self.preprocess(data)
|
102 |
+
|
103 |
+
for row_id, row in data.iterrows():
|
104 |
+
data_row = dict(row)
|
105 |
+
|
106 |
+
yield row_id, data_row
|
107 |
+
|
108 |
+
def preprocess(self, data: pandas.DataFrame) -> pandas.DataFrame:
|
109 |
+
data.columns = _BASE_FEATURE_NAMES
|
110 |
+
data.drop("name", axis="columns", inplace=True)
|
111 |
+
|
112 |
+
if self.config.name == "hayes_1":
|
113 |
+
data.loc[:, "class"] = data["class"].apply(lambda x: 1 if x == 1 else 0)
|
114 |
+
elif self.config.name == "hayes_2":
|
115 |
+
data.loc[:, "class"] = data["class"].apply(lambda x: 1 if x == 2 else 0)
|
116 |
+
elif self.config.name == "hayes_3":
|
117 |
+
data.loc[:, "class"] = data["class"].apply(lambda x: 1 if x == 3 else 0)
|
118 |
+
|
119 |
+
return data
|