Upload 3 files
Browse files- README.md +29 -1
- twonorm.csv +0 -0
- twonorm.py +64 -0
README.md
CHANGED
|
@@ -1,3 +1,31 @@
|
|
| 1 |
---
|
| 2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
language:
|
| 3 |
+
- en
|
| 4 |
+
tags:
|
| 5 |
+
- twonorm
|
| 6 |
+
- tabular_classification
|
| 7 |
+
- binary_classification
|
| 8 |
+
pretty_name: Two Norm
|
| 9 |
+
size_categories:
|
| 10 |
+
- 1K<n<10K
|
| 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 |
+
- 8hr
|
| 15 |
+
- 1hr
|
| 16 |
---
|
| 17 |
+
# TwoNorm
|
| 18 |
+
The [TwoNorm dataset](https://www.openml.org/search?type=data&status=active&id=1507) from the [OpenML repository](https://www.openml.org/).
|
| 19 |
+
|
| 20 |
+
# Configurations and tasks
|
| 21 |
+
| **Configuration** | **Task** |
|
| 22 |
+
|-------------------|---------------------------|
|
| 23 |
+
| twonorm | Binary classification |
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
# Usage
|
| 27 |
+
```python
|
| 28 |
+
from datasets import load_dataset
|
| 29 |
+
|
| 30 |
+
dataset = load_dataset("mstz/twonorm", "twonorm")["train"]
|
| 31 |
+
```
|
twonorm.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
twonorm.py
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""TwoNorm"""
|
| 2 |
+
|
| 3 |
+
from typing import List
|
| 4 |
+
|
| 5 |
+
import datasets
|
| 6 |
+
|
| 7 |
+
import pandas
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
VERSION = datasets.Version("1.0.0")
|
| 11 |
+
|
| 12 |
+
DESCRIPTION = "TwoNorm dataset from the OpenML repository."
|
| 13 |
+
_HOMEPAGE = "https://www.openml.org/search?type=data&status=active&id=1507"
|
| 14 |
+
_URLS = ("https://www.openml.org/search?type=data&status=active&id=1507")
|
| 15 |
+
_CITATION = """"""
|
| 16 |
+
|
| 17 |
+
# Dataset info
|
| 18 |
+
urls_per_split = {
|
| 19 |
+
"train": "https://huggingface.co/datasets/mstz/two_norm/raw/main/twonorm.csv"
|
| 20 |
+
}
|
| 21 |
+
features_types_per_config = {
|
| 22 |
+
"twonorm": {
|
| 23 |
+
datasets.ClassLabel(num_classes=2, names=("no", "yes"))
|
| 24 |
+
},
|
| 25 |
+
|
| 26 |
+
}
|
| 27 |
+
features_per_config = {k: datasets.Features(features_types_per_config[k]) for k in features_types_per_config}
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
class TwoNormConfig(datasets.BuilderConfig):
|
| 31 |
+
def __init__(self, **kwargs):
|
| 32 |
+
super(TwoNormConfig, self).__init__(version=VERSION, **kwargs)
|
| 33 |
+
self.features = features_per_config[kwargs["name"]]
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
class TwoNorm(datasets.GeneratorBasedBuilder):
|
| 37 |
+
# dataset versions
|
| 38 |
+
DEFAULT_CONFIG = "twonorm"
|
| 39 |
+
BUILDER_CONFIGS = [
|
| 40 |
+
TwoNormConfig(name="twonorm",
|
| 41 |
+
description="TwoNorm for binary classification.")
|
| 42 |
+
]
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
def _info(self):
|
| 46 |
+
info = datasets.DatasetInfo(description=DESCRIPTION, citation=_CITATION, homepage=_HOMEPAGE,
|
| 47 |
+
features=features_per_config[self.config.name])
|
| 48 |
+
|
| 49 |
+
return info
|
| 50 |
+
|
| 51 |
+
def _split_generators(self, dl_manager: datasets.DownloadManager) -> List[datasets.SplitGenerator]:
|
| 52 |
+
downloads = dl_manager.download_and_extract(urls_per_split)
|
| 53 |
+
|
| 54 |
+
return [
|
| 55 |
+
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloads[self.config.name]["train"]})
|
| 56 |
+
]
|
| 57 |
+
|
| 58 |
+
def _generate_examples(self, filepath: str):
|
| 59 |
+
data = pandas.read_csv(filepath)
|
| 60 |
+
|
| 61 |
+
for row_id, row in data.iterrows():
|
| 62 |
+
data_row = dict(row)
|
| 63 |
+
|
| 64 |
+
yield row_id, data_row
|