mstz commited on
Commit
40fca8a
1 Parent(s): 5c6e4d2

Upload 3 files

Browse files
Files changed (3) hide show
  1. README.md +28 -1
  2. pol.csv +0 -0
  3. pol.py +111 -0
README.md CHANGED
@@ -1,3 +1,30 @@
1
  ---
2
- license: cc-by-4.0
 
 
 
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ language:
3
+ - en
4
+ tags:
5
+ - pol
6
+ - tabular_classification
7
+ - binary_classification
8
+ pretty_name: Pol
9
+ size_categories:
10
+ - 10k<n<100K
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
+ - pol
15
  ---
16
+ # Pol
17
+ The [Pol dataset](https://www.openml.org/search?type=data&sort=runs&id=151&status=active) from the [OpenML repository](https://www.openml.org/).
18
+
19
+ # Configurations and tasks
20
+ | **Configuration** | **Task** | **Description** |
21
+ |-------------------|---------------------------|-------------------------|
22
+ | pol | Binary classification | Has the pol cost gone up?|
23
+
24
+
25
+ # Usage
26
+ ```python
27
+ from datasets import load_dataset
28
+
29
+ dataset = load_dataset("mstz/pol", "pol")["train"]
30
+ ```
pol.csv ADDED
The diff for this file is too large to render. See raw diff
 
pol.py ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import List
2
+
3
+ import datasets
4
+
5
+ import pandas
6
+
7
+
8
+ VERSION = datasets.Version("1.0.0")
9
+
10
+
11
+ DESCRIPTION = "Pol dataset from the OpenML repository."
12
+ _HOMEPAGE = "https://www.openml.org/search?type=data&sort=runs&id=722&status=active"
13
+ _URLS = ("https://www.openml.org/search?type=data&sort=runs&id=722&status=active")
14
+ _CITATION = """"""
15
+
16
+ # Dataset info
17
+ urls_per_split = {
18
+ "train": "https://huggingface.co/datasets/mstz/pol/raw/main/pol.csv"
19
+ }
20
+ features_types_per_config = {
21
+ "pol": {
22
+ "f1": datasets.Value("int64"),
23
+ "f2": datasets.Value("int64"),
24
+ "f3": datasets.Value("int64"),
25
+ "f4": datasets.Value("int64"),
26
+ "f5": datasets.Value("int64"),
27
+ "f6": datasets.Value("int64"),
28
+ "f7": datasets.Value("int64"),
29
+ "f8": datasets.Value("int64"),
30
+ "f9": datasets.Value("int64"),
31
+ "f10": datasets.Value("int64"),
32
+ "f11": datasets.Value("int64"),
33
+ "f12": datasets.Value("int64"),
34
+ "f13": datasets.Value("int64"),
35
+ "f14": datasets.Value("int64"),
36
+ "f15": datasets.Value("int64"),
37
+ "f16": datasets.Value("int64"),
38
+ "f17": datasets.Value("int64"),
39
+ "f18": datasets.Value("int64"),
40
+ "f19": datasets.Value("int64"),
41
+ "f20": datasets.Value("int64"),
42
+ "f21": datasets.Value("int64"),
43
+ "f22": datasets.Value("int64"),
44
+ "f23": datasets.Value("int64"),
45
+ "f24": datasets.Value("int64"),
46
+ "f25": datasets.Value("int64"),
47
+ "f26": datasets.Value("int64"),
48
+ "f27": datasets.Value("int64"),
49
+ "f28": datasets.Value("int64"),
50
+ "f29": datasets.Value("int64"),
51
+ "f30": datasets.Value("int64"),
52
+ "f31": datasets.Value("int64"),
53
+ "f32": datasets.Value("int64"),
54
+ "f33": datasets.Value("int64"),
55
+ "f34": datasets.Value("int64"),
56
+ "f35": datasets.Value("int64"),
57
+ "f36": datasets.Value("int64"),
58
+ "f37": datasets.Value("int64"),
59
+ "f38": datasets.Value("int64"),
60
+ "f39": datasets.Value("int64"),
61
+ "f40": datasets.Value("int64"),
62
+ "f41": datasets.Value("int64"),
63
+ "f42": datasets.Value("int64"),
64
+ "f43": datasets.Value("int64"),
65
+ "f44": datasets.Value("int64"),
66
+ "f45": datasets.Value("int64"),
67
+ "f46": datasets.Value("int64"),
68
+ "f47": datasets.Value("int64"),
69
+ "f48": datasets.Value("int64"),
70
+ "class": datasets.ClassLabel(num_classes=2, names=("no", "yes"))
71
+ }
72
+
73
+ }
74
+ features_per_config = {k: datasets.Features(features_types_per_config[k]) for k in features_types_per_config}
75
+
76
+
77
+ class ElectricityConfig(datasets.BuilderConfig):
78
+ def __init__(self, **kwargs):
79
+ super(ElectricityConfig, self).__init__(version=VERSION, **kwargs)
80
+ self.features = features_per_config[kwargs["name"]]
81
+
82
+
83
+ class Electricity(datasets.GeneratorBasedBuilder):
84
+ # dataset versions
85
+ DEFAULT_CONFIG = "pol"
86
+ BUILDER_CONFIGS = [
87
+ ElectricityConfig(name="pol",
88
+ description="Electricity for binary classification.")
89
+ ]
90
+
91
+
92
+ def _info(self):
93
+ info = datasets.DatasetInfo(description=DESCRIPTION, citation=_CITATION, homepage=_HOMEPAGE,
94
+ features=features_per_config[self.config.name])
95
+
96
+ return info
97
+
98
+ def _split_generators(self, dl_manager: datasets.DownloadManager) -> List[datasets.SplitGenerator]:
99
+ downloads = dl_manager.download_and_extract(urls_per_split)
100
+
101
+ return [
102
+ datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloads["train"]})
103
+ ]
104
+
105
+ def _generate_examples(self, filepath: str):
106
+ data = pandas.read_csv(filepath)
107
+
108
+ for row_id, row in data.iterrows():
109
+ data_row = dict(row)
110
+
111
+ yield row_id, data_row