mstz commited on
Commit
d7411e8
1 Parent(s): 912160e

Upload 6 files

Browse files
README.md CHANGED
@@ -1,3 +1,44 @@
1
  ---
2
- license: cc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ language:
3
+ - en
4
+ tags:
5
+ - balloons
6
+ - tabular_classification
7
+ - binary_classification
8
+ pretty_name: Balloons
9
+ size_categories:
10
+ - 100<n<10
11
+ task_categories: # Full list at https://github.com/huggingface/hub-docs/blob/main/js/src/lib/interfaces/Types.ts
12
+ - tabular-classification
13
+ configs:
14
+ - adult_or_stretch
15
+ - adult_and_stretch
16
+ - yellow_and_small
17
+ - yellow_and_small_or_adult_and_stretch
18
  ---
19
+ # Balloons
20
+ The [Balloons dataset](https://archive.ics.uci.edu/ml/datasets/Balloons) from the [UCI ML repository](https://archive.ics.uci.edu/ml/datasets).
21
+ Predict if the given balloon is inflated.
22
+
23
+ # Configurations and tasks
24
+ | **Configuration** | **Task** | Description |
25
+ |--------------------------------------------|---------------------------|--------------------------------------------------------------------------------------------------|
26
+ | adult_or_stretch | Binary classification | Balloons are inflated if age == adult or act == stretch. |
27
+ | adult_and_stretch | Binary classification | Balloons are inflated if age == adult and act == stretch. |
28
+ | yellow_and_small | Binary classification | Balloons are inflated if color == yellow and size == small. |
29
+ | yellow_and_small_or_adult_and_stretch | Binary classification | Balloons are inflated if color == yellow and size == small or age == adult and act == stretch. |
30
+
31
+ # Usage
32
+ ```python
33
+ from datasets import load_dataset
34
+
35
+ dataset = load_dataset("mstz/balloons", "adult_or_stretch")["train"]
36
+ ```
37
+
38
+ # Features
39
+ |**Feature** |**Type** | **Description** |
40
+ |-------------------|-----------|-------------------|
41
+ |`color` |`[string]` | Balloon's color. |
42
+ |`size` |`[string]` | Balloon's size. |
43
+ |`act` |`[string]` | Balloon's state. |
44
+ |`age` |`[string]` | Balloon's age. |
adult+stretch.data ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ YELLOW,SMALL,STRETCH,ADULT,T
2
+ YELLOW,SMALL,STRETCH,ADULT,T
3
+ YELLOW,SMALL,STRETCH,CHILD,F
4
+ YELLOW,SMALL,DIP,ADULT,F
5
+ YELLOW,SMALL,DIP,CHILD,F
6
+ YELLOW,LARGE,STRETCH,ADULT,T
7
+ YELLOW,LARGE,STRETCH,ADULT,T
8
+ YELLOW,LARGE,STRETCH,CHILD,F
9
+ YELLOW,LARGE,DIP,ADULT,F
10
+ YELLOW,LARGE,DIP,CHILD,F
11
+ PURPLE,SMALL,STRETCH,ADULT,T
12
+ PURPLE,SMALL,STRETCH,ADULT,T
13
+ PURPLE,SMALL,STRETCH,CHILD,F
14
+ PURPLE,SMALL,DIP,ADULT,F
15
+ PURPLE,SMALL,DIP,CHILD,F
16
+ PURPLE,LARGE,STRETCH,ADULT,T
17
+ PURPLE,LARGE,STRETCH,ADULT,T
18
+ PURPLE,LARGE,STRETCH,CHILD,F
19
+ PURPLE,LARGE,DIP,ADULT,F
20
+ PURPLE,LARGE,DIP,CHILD,F
adult-stretch.data ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ YELLOW,SMALL,STRETCH,ADULT,T
2
+ YELLOW,SMALL,STRETCH,CHILD,T
3
+ YELLOW,SMALL,DIP,ADULT,T
4
+ YELLOW,SMALL,DIP,CHILD,F
5
+ YELLOW,SMALL,DIP,CHILD,F
6
+ YELLOW,LARGE,STRETCH,ADULT,T
7
+ YELLOW,LARGE,STRETCH,CHILD,T
8
+ YELLOW,LARGE,DIP,ADULT,T
9
+ YELLOW,LARGE,DIP,CHILD,F
10
+ YELLOW,LARGE,DIP,CHILD,F
11
+ PURPLE,SMALL,STRETCH,ADULT,T
12
+ PURPLE,SMALL,STRETCH,CHILD,T
13
+ PURPLE,SMALL,DIP,ADULT,T
14
+ PURPLE,SMALL,DIP,CHILD,F
15
+ PURPLE,SMALL,DIP,CHILD,F
16
+ PURPLE,LARGE,STRETCH,ADULT,T
17
+ PURPLE,LARGE,STRETCH,CHILD,T
18
+ PURPLE,LARGE,DIP,ADULT,T
19
+ PURPLE,LARGE,DIP,CHILD,F
20
+ PURPLE,LARGE,DIP,CHILD,F
balloons.py ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Balloons."""
2
+
3
+ from typing import List
4
+
5
+ import datasets
6
+
7
+ import pandas
8
+
9
+
10
+ VERSION = datasets.Version("1.0.0")
11
+ _BASE_FEATURE_NAMES = [
12
+ "color",
13
+ "size",
14
+ "act",
15
+ "age",
16
+ "inflated"
17
+ ]
18
+
19
+
20
+ DESCRIPTION = "Balloons dataset from the UCI ML repository."
21
+ _HOMEPAGE = "https://archive.ics.uci.edu/ml/datasets/Balloons"
22
+ _URLS = ("https://huggingface.co/datasets/mstz/balloons/raw/balloons.csv")
23
+ _CITATION = """
24
+ @misc{misc_balloons_13,
25
+ title = {{Balloons}},
26
+ howpublished = {UCI Machine Learning Repository},
27
+ note = {{DOI}: \\url{10.24432/C5BP4D}}
28
+ }"""
29
+
30
+ # Dataset info
31
+ urls_per_split = {
32
+ "adult_or_stretch": {"train": "https://huggingface.co/datasets/mstz/balloons/raw/main/adult+stretch.data"},
33
+ "adult_and_stretch": {"train": "https://huggingface.co/datasets/mstz/balloons/raw/main/adult-stretch.data"},
34
+ "yellow_and_small": {"train": "https://huggingface.co/datasets/mstz/balloons/raw/main/yellow-small.data"},
35
+ "yellow_and_small_or_adult_and_stretch": {"train": "https://huggingface.co/datasets/mstz/balloons/raw/main/yellow-small+adult-stretch.data"}
36
+ }
37
+ features_types_per_config = {
38
+ "adult_or_stretch": {
39
+ "color": datasets.Value("string"),
40
+ "size": datasets.Value("string"),
41
+ "act": datasets.Value("string"),
42
+ "age": datasets.Value("string"),
43
+ "inflated": datasets.ClassLabel(num_classes=2)
44
+ },
45
+ "adult_and_stretch": {
46
+ "color": datasets.Value("string"),
47
+ "size": datasets.Value("string"),
48
+ "act": datasets.Value("string"),
49
+ "age": datasets.Value("string"),
50
+ "inflated": datasets.ClassLabel(num_classes=2)
51
+ },
52
+ "yellow_and_small": {
53
+ "color": datasets.Value("string"),
54
+ "size": datasets.Value("string"),
55
+ "act": datasets.Value("string"),
56
+ "age": datasets.Value("string"),
57
+ "inflated": datasets.ClassLabel(num_classes=2)
58
+ },
59
+ "yellow_and_small_or_adult_and_stretch": {
60
+ "color": datasets.Value("string"),
61
+ "size": datasets.Value("string"),
62
+ "act": datasets.Value("string"),
63
+ "age": datasets.Value("string"),
64
+ "inflated": datasets.ClassLabel(num_classes=2)
65
+ }
66
+ }
67
+ features_per_config = {k: datasets.Features(features_types_per_config[k]) for k in features_types_per_config}
68
+
69
+
70
+ class BalloonsConfig(datasets.BuilderConfig):
71
+ def __init__(self, **kwargs):
72
+ super(BalloonsConfig, self).__init__(version=VERSION, **kwargs)
73
+ self.features = features_per_config[kwargs["name"]]
74
+
75
+
76
+ class Balloons(datasets.GeneratorBasedBuilder):
77
+ # dataset versions
78
+ DEFAULT_CONFIG = "adult_or_stretch"
79
+ BUILDER_CONFIGS = [
80
+ BalloonsConfig(name="adult_or_stretch",
81
+ description="Binary classification, balloons are inflated if age == adult or act == stretch."),
82
+ BalloonsConfig(name="adult_and_stretch",
83
+ description="Binary classification, balloons are inflated if age == adult and act == stretch."),
84
+ BalloonsConfig(name="yellow_and_small",
85
+ description="Binary classification, balloons are inflated if color == yellow and size == small."),
86
+ BalloonsConfig(name="yellow_and_small_or_adult_and_stretch",
87
+ description="Binary classification, balloons are inflated if color == yellow and size == small or age == adult and act == stretch.")
88
+ ]
89
+
90
+
91
+ def _info(self):
92
+ info = datasets.DatasetInfo(description=DESCRIPTION, citation=_CITATION, homepage=_HOMEPAGE,
93
+ features=features_per_config[self.config.name])
94
+
95
+ return info
96
+
97
+ def _split_generators(self, dl_manager: datasets.DownloadManager) -> List[datasets.SplitGenerator]:
98
+ downloads_per_config = {config: dl_manager.download_and_extract(urls_per_split) for config in urls_per_split}
99
+
100
+ return [
101
+ datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloads_per_config[self.config.name]["train"]})
102
+ ]
103
+
104
+ def _generate_examples(self, filepath: str):
105
+ data = pandas.read_csv(filepath, header=None)
106
+ data.columns = _BASE_FEATURE_NAMES
107
+ data.loc[:, "inflated"] = data.inflated.apply(lambda x: 1 if x == "T" else 0)
108
+
109
+ for row_id, row in data.iterrows():
110
+ data_row = dict(row)
111
+
112
+ yield row_id, data_row
yellow-small+adult-stretch.data ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ YELLOW,SMALL,STRETCH,ADULT,T
2
+ YELLOW,SMALL,STRETCH,CHILD,T
3
+ YELLOW,SMALL,DIP,ADULT,T
4
+ YELLOW,SMALL,DIP,CHILD,T
5
+ YELLOW,LARGE,STRETCH,ADULT,T
6
+ YELLOW,LARGE,STRETCH,CHILD,F
7
+ YELLOW,LARGE,DIP,ADULT,F
8
+ YELLOW,LARGE,DIP,CHILD,F
9
+ PURPLE,SMALL,STRETCH,ADULT,T
10
+ PURPLE,SMALL,STRETCH,CHILD,F
11
+ PURPLE,SMALL,DIP,ADULT,F
12
+ PURPLE,SMALL,DIP,CHILD,F
13
+ PURPLE,LARGE,STRETCH,ADULT,T
14
+ PURPLE,LARGE,STRETCH,CHILD,F
15
+ PURPLE,LARGE,DIP,ADULT,F
16
+ PURPLE,LARGE,DIP,CHILD,F
yellow-small.data ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ YELLOW,SMALL,STRETCH,ADULT,T
2
+ YELLOW,SMALL,STRETCH,CHILD,T
3
+ YELLOW,SMALL,DIP,ADULT,T
4
+ YELLOW,SMALL,DIP,CHILD,T
5
+ YELLOW,SMALL,STRETCH,ADULT,T
6
+ YELLOW,SMALL,STRETCH,CHILD,T
7
+ YELLOW,SMALL,DIP,ADULT,T
8
+ YELLOW,SMALL,DIP,CHILD,T
9
+ YELLOW,LARGE,STRETCH,ADULT,F
10
+ YELLOW,LARGE,STRETCH,CHILD,F
11
+ YELLOW,LARGE,DIP,ADULT,F
12
+ YELLOW,LARGE,DIP,CHILD,F
13
+ PURPLE,SMALL,STRETCH,ADULT,F
14
+ PURPLE,SMALL,STRETCH,CHILD,F
15
+ PURPLE,SMALL,DIP,ADULT,F
16
+ PURPLE,SMALL,DIP,CHILD,F
17
+ PURPLE,LARGE,STRETCH,ADULT,F
18
+ PURPLE,LARGE,STRETCH,CHILD,F
19
+ PURPLE,LARGE,DIP,ADULT,F
20
+ PURPLE,LARGE,DIP,CHILD,F