Datasets:
Upload 3 files
Browse files- README.md +17 -1
- arcene.py +85 -0
- arcene_train.data +0 -0
README.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
| 1 |
---
|
| 2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
language:
|
| 3 |
+
- en
|
| 4 |
+
tags:
|
| 5 |
+
- arcene
|
| 6 |
+
- tabular_classification
|
| 7 |
+
- binary_classification
|
| 8 |
+
- UCI
|
| 9 |
+
pretty_name: Arcene
|
| 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 |
+
- arcene
|
| 16 |
---
|
| 17 |
+
# Arcene
|
| 18 |
+
The [Arcene dataset](https://archive-beta.ics.uci.edu/dataset/167/arcene) from the [UCI repository](https://archive-beta.ics.uci.edu/).
|
| 19 |
+
|
arcene.py
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Arcene 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 |
+
|
| 16 |
+
DESCRIPTION = "Arcene dataset."
|
| 17 |
+
_HOMEPAGE = "https://archive-beta.ics.uci.edu/dataset/167/arcene"
|
| 18 |
+
_URLS = ("https://archive-beta.ics.uci.edu/dataset/167/arcene")
|
| 19 |
+
_CITATION = """
|
| 20 |
+
@misc{misc_arcene_167,
|
| 21 |
+
author = {Guyon,Isabelle, Gunn,Steve, Ben-Hur,Asa & Dror,Gideon},
|
| 22 |
+
title = {{Arcene}},
|
| 23 |
+
year = {2008},
|
| 24 |
+
howpublished = {UCI Machine Learning Repository},
|
| 25 |
+
note = {{DOI}: \\url{10.24432/C58P55}}
|
| 26 |
+
}
|
| 27 |
+
"""
|
| 28 |
+
|
| 29 |
+
# Dataset info
|
| 30 |
+
urls_per_split = {
|
| 31 |
+
"train": "https://huggingface.co/datasets/mstz/arcene/raw/main/arcene_train.data"
|
| 32 |
+
}
|
| 33 |
+
features_types_per_config = {
|
| 34 |
+
"arcene": {f"feature_{i}": datasets.Value("float64") for i in range(10000)}
|
| 35 |
+
}
|
| 36 |
+
features_types_per_config["arcene"]["class"] = datasets.ClassLabel(num_classes=2)
|
| 37 |
+
features_per_config = {k: datasets.Features(features_types_per_config[k]) for k in features_types_per_config}
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
class ArceneConfig(datasets.BuilderConfig):
|
| 41 |
+
def __init__(self, **kwargs):
|
| 42 |
+
super(ArceneConfig, self).__init__(version=VERSION, **kwargs)
|
| 43 |
+
self.features = features_per_config[kwargs["name"]]
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
class Arcene(datasets.GeneratorBasedBuilder):
|
| 47 |
+
# dataset versions
|
| 48 |
+
DEFAULT_CONFIG = "arcene"
|
| 49 |
+
BUILDER_CONFIGS = [ArceneConfig(name="arcene", description="Arcene for binary classification.")]
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
def _info(self):
|
| 53 |
+
info = datasets.DatasetInfo(description=DESCRIPTION, citation=_CITATION, homepage=_HOMEPAGE,
|
| 54 |
+
features=features_per_config[self.config.name])
|
| 55 |
+
|
| 56 |
+
return info
|
| 57 |
+
|
| 58 |
+
def _split_generators(self, dl_manager: datasets.DownloadManager) -> List[datasets.SplitGenerator]:
|
| 59 |
+
downloads = dl_manager.download_and_extract(urls_per_split)
|
| 60 |
+
|
| 61 |
+
return [
|
| 62 |
+
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloads["train"]}),
|
| 63 |
+
]
|
| 64 |
+
|
| 65 |
+
def _generate_examples(self, filepath: str):
|
| 66 |
+
data = pandas.read_csv(filepath, header=None)
|
| 67 |
+
columns = [f"feature_{i}" for i in range(10000)] + ["class"]
|
| 68 |
+
data.columns = columns
|
| 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}")
|
arcene_train.data
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|