mstz commited on
Commit
fdc6b06
·
1 Parent(s): f6580fe

updated to datasets 4.*

Browse files
README.md CHANGED
@@ -1,18 +1,20 @@
1
  ---
2
- language:
3
- - en
 
 
 
 
 
 
 
 
4
  tags:
5
- - madelon
6
  - tabular_classification
7
- - UCI
8
- pretty_name: Madelon
9
- size_categories:
10
- - 1K<n<10K
11
  task_categories:
12
  - tabular-classification
13
- configs:
14
- - Madelon
15
- license: cc
16
  ---
17
  # Annealing
18
  The [Madelon dataset](https://archive-beta.ics.uci.edu/dataset/171/madelon) from the [UCI ML repository](https://archive.ics.uci.edu/ml/datasets).
 
1
  ---
2
+ configs:
3
+ - config_name: madelon
4
+ data_files:
5
+ - path: madelon/train.csv
6
+ split: train
7
+ default: true
8
+ language: en
9
+ license: cc
10
+ pretty_name: Madelon
11
+ size_categories: 1M<n<10M
12
  tags:
 
13
  - tabular_classification
14
+ - binary_classification
15
+ - multiclass_classification
 
 
16
  task_categories:
17
  - tabular-classification
 
 
 
18
  ---
19
  # Annealing
20
  The [Madelon dataset](https://archive-beta.ics.uci.edu/dataset/171/madelon) from the [UCI ML repository](https://archive.ics.uci.edu/ml/datasets).
madelon.py DELETED
@@ -1,75 +0,0 @@
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 = "Madelon dataset from the UCI ML repository."
12
- _HOMEPAGE = "https://archive-beta.ics.uci.edu/dataset/3/madelon"
13
- _URLS = ("https://archive-beta.ics.uci.edu/dataset/3/madelon")
14
- _CITATION = """"""
15
-
16
- # Dataset info
17
- urls_per_split = {
18
- "train": "https://huggingface.co/datasets/mstz/madelon/raw/main/madelon_train.csv",
19
- "validation": "https://huggingface.co/datasets/mstz/madelon/raw/main/madelon_valid.csv"
20
- }
21
- features_types_per_config = {
22
- "madelon": {str(i): datasets.Value("int16") for i in range(500)}
23
- }
24
- features_types_per_config["madelon"]["500"] = datasets.ClassLabel(num_classes=2)
25
-
26
- features_per_config = {k: datasets.Features(features_types_per_config[k]) for k in features_types_per_config}
27
-
28
-
29
- class MadelonConfig(datasets.BuilderConfig):
30
- def __init__(self, **kwargs):
31
- super(MadelonConfig, self).__init__(version=VERSION, **kwargs)
32
- self.features = features_per_config[kwargs["name"]]
33
-
34
-
35
- class Madelon(datasets.GeneratorBasedBuilder):
36
- # dataset versions
37
- DEFAULT_CONFIG = "madelon"
38
- BUILDER_CONFIGS = [
39
- MadelonConfig(name="madelon",
40
- description="Madelon for multiclass classification.")
41
- ]
42
-
43
-
44
- def _info(self):
45
- if self.config.name not in features_per_config:
46
- raise ValueError(f"Unknown configuration: {self.config.name}")
47
-
48
- info = datasets.DatasetInfo(description=DESCRIPTION, citation=_CITATION, homepage=_HOMEPAGE,
49
- features=features_per_config[self.config.name])
50
-
51
- return info
52
-
53
- def _split_generators(self, dl_manager: datasets.DownloadManager) -> List[datasets.SplitGenerator]:
54
- downloads = dl_manager.download_and_extract(urls_per_split)
55
-
56
- return [
57
- datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloads["train"]}),
58
- datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={"filepath": downloads["validation"]})
59
- ]
60
-
61
- def _generate_examples(self, filepath: str):
62
- data = pandas.read_csv(filepath)
63
- data = self.preprocess(data, config=self.config.name)
64
-
65
- for row_id, row in data.iterrows():
66
- data_row = dict(row)
67
-
68
- yield row_id, data_row
69
-
70
- def preprocess(self, data: pandas.DataFrame, config: str = DEFAULT_CONFIG) -> pandas.DataFrame:
71
- data["500"] = data["500"].apply(lambda x: max(0, x)).astype(int)
72
- if "0.1" in data:
73
- data.drop("0.1", axis="columns", inplace=True)
74
-
75
- return data
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
madelon_train.csv → madelon/train.csv RENAMED
The diff for this file is too large to render. See raw diff
 
madelon_valid.csv DELETED
The diff for this file is too large to render. See raw diff