Datasets:
Tasks:
Tabular Classification
Languages:
English
Upload 3 files
Browse files- .gitattributes +1 -0
- README.md +18 -1
- gisette.data +3 -0
- gisette.py +85 -0
.gitattributes
CHANGED
@@ -52,3 +52,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
52 |
*.jpg filter=lfs diff=lfs merge=lfs -text
|
53 |
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
54 |
*.webp filter=lfs diff=lfs merge=lfs -text
|
|
|
|
52 |
*.jpg filter=lfs diff=lfs merge=lfs -text
|
53 |
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
54 |
*.webp filter=lfs diff=lfs merge=lfs -text
|
55 |
+
gisette.data filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
@@ -1,3 +1,20 @@
|
|
1 |
---
|
2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
+
language:
|
3 |
+
- en
|
4 |
+
tags:
|
5 |
+
- gisette
|
6 |
+
- tabular_classification
|
7 |
+
- binary_classification
|
8 |
+
pretty_name: Gisette
|
9 |
+
task_categories: # Full list at https://github.com/huggingface/hub-docs/blob/main/js/src/lib/interfaces/Types.ts
|
10 |
+
- tabular-classification
|
11 |
+
configs:
|
12 |
+
- gisette
|
13 |
---
|
14 |
+
# Gisette
|
15 |
+
The [Gisette dataset](https://archive-beta.ics.uci.edu/dataset/170/gisette) from the [UCI repository](https://archive-beta.ics.uci.edu/).
|
16 |
+
|
17 |
+
# Configurations and tasks
|
18 |
+
| **Configuration** | **Task** | **Description** |
|
19 |
+
|-----------------------|---------------------------|-------------------------|
|
20 |
+
| gisette | Binary classification.| |
|
gisette.data
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9b74d001c8a0bde9d4d1bb56f5bdedc18518947f7d17a5e44b1478584b02be1a
|
3 |
+
size 79112638
|
gisette.py
ADDED
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""Gisette Dataset"""
|
2 |
+
|
3 |
+
from typing import List
|
4 |
+
from functools import partial
|
5 |
+
|
6 |
+
import datasets
|
7 |
+
|
8 |
+
import pandas
|
9 |
+
|
10 |
+
|
11 |
+
VERSION = datasets.Version("1.0.0")
|
12 |
+
|
13 |
+
_ENCODING_DICS = {}
|
14 |
+
|
15 |
+
DESCRIPTION = "Gisette dataset."
|
16 |
+
_HOMEPAGE = "https://archive-beta.ics.uci.edu/dataset/170/gisette"
|
17 |
+
_URLS = ("https://archive-beta.ics.uci.edu/dataset/170/gisette")
|
18 |
+
_CITATION = """
|
19 |
+
@misc{misc_gisette_170,
|
20 |
+
author = {Guyon,Isabelle, Gunn,Steve, Ben-Hur,Asa & Dror,Gideon},
|
21 |
+
title = {{Gisette}},
|
22 |
+
year = {2008},
|
23 |
+
howpublished = {UCI Machine Learning Repository},
|
24 |
+
note = {{DOI}: \\url{10.24432/C5HP5B}}
|
25 |
+
}
|
26 |
+
"""
|
27 |
+
|
28 |
+
# Dataset info
|
29 |
+
urls_per_split = {
|
30 |
+
"train": "https://huggingface.co/datasets/mstz/gisette/resolve/main/gisette.data"
|
31 |
+
}
|
32 |
+
features_types_per_config = {
|
33 |
+
"gisette": {f"feature_{i}": datasets.Value("int64") for i in range(5000)}
|
34 |
+
}
|
35 |
+
features_types_per_config["class"] = datasets.ClassLabel(num_classes=2)
|
36 |
+
features_per_config = {k: datasets.Features(features_types_per_config[k]) for k in features_types_per_config}
|
37 |
+
|
38 |
+
|
39 |
+
class GisetteConfig(datasets.BuilderConfig):
|
40 |
+
def __init__(self, **kwargs):
|
41 |
+
super(GisetteConfig, self).__init__(version=VERSION, **kwargs)
|
42 |
+
self.features = features_per_config[kwargs["name"]]
|
43 |
+
|
44 |
+
|
45 |
+
class Gisette(datasets.GeneratorBasedBuilder):
|
46 |
+
# dataset versions
|
47 |
+
DEFAULT_CONFIG = "gisette"
|
48 |
+
BUILDER_CONFIGS = [
|
49 |
+
GisetteConfig(name="gisette", description="Gisette for multiclass classification.")
|
50 |
+
]
|
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, header=None)
|
68 |
+
data = self.preprocess(data)
|
69 |
+
|
70 |
+
for row_id, row in data.iterrows():
|
71 |
+
data_row = dict(row)
|
72 |
+
|
73 |
+
yield row_id, data_row
|
74 |
+
|
75 |
+
def preprocess(self, data: pandas.DataFrame) -> pandas.DataFrame:
|
76 |
+
for feature in _ENCODING_DICS:
|
77 |
+
encoding_function = partial(self.encode, feature)
|
78 |
+
data.loc[:, feature] = data[feature].apply(encoding_function)
|
79 |
+
|
80 |
+
return data[list(features_types_per_config[self.config.name].keys())]
|
81 |
+
|
82 |
+
def encode(self, feature, value):
|
83 |
+
if feature in _ENCODING_DICS:
|
84 |
+
return _ENCODING_DICS[feature][value]
|
85 |
+
raise ValueError(f"Unknown feature: {feature}")
|