updated to datasets 4.*
Browse files- README.md +11 -9
- Wine_Quality_Data.csv +0 -0
- wine.py +0 -101
- wine/train.csv +0 -0
README.md
CHANGED
|
@@ -1,18 +1,20 @@
|
|
| 1 |
---
|
| 2 |
-
|
| 3 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
tags:
|
| 5 |
-
- wine
|
| 6 |
- tabular_classification
|
| 7 |
- binary_classification
|
| 8 |
-
|
| 9 |
-
size_categories:
|
| 10 |
-
- 1K<n<10K
|
| 11 |
task_categories:
|
| 12 |
- tabular-classification
|
| 13 |
-
configs:
|
| 14 |
-
- wine
|
| 15 |
-
license: cc
|
| 16 |
---
|
| 17 |
# Wine
|
| 18 |
The [Wine dataset](https://www.kaggle.com/datasets/ghassenkhaled/wine-quality-data) from Kaggle.
|
|
|
|
| 1 |
---
|
| 2 |
+
configs:
|
| 3 |
+
- config_name: wine
|
| 4 |
+
data_files:
|
| 5 |
+
- path: wine/train.csv
|
| 6 |
+
split: train
|
| 7 |
+
default: true
|
| 8 |
+
language: en
|
| 9 |
+
license: cc
|
| 10 |
+
pretty_name: Wine
|
| 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 |
# Wine
|
| 20 |
The [Wine dataset](https://www.kaggle.com/datasets/ghassenkhaled/wine-quality-data) from Kaggle.
|
Wine_Quality_Data.csv
DELETED
|
The diff for this file is too large to render.
See raw diff
|
|
|
wine.py
DELETED
|
@@ -1,101 +0,0 @@
|
|
| 1 |
-
"""Wine Dataset"""
|
| 2 |
-
|
| 3 |
-
from typing import List
|
| 4 |
-
|
| 5 |
-
import datasets
|
| 6 |
-
|
| 7 |
-
import pandas
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
VERSION = datasets.Version("1.0.0")
|
| 11 |
-
_BASE_FEATURE_NAMES = [
|
| 12 |
-
"fixed_acidity",
|
| 13 |
-
"volatile_acidity",
|
| 14 |
-
"citric_acid",
|
| 15 |
-
"residual_sugar",
|
| 16 |
-
"chlorides",
|
| 17 |
-
"free_sulfur_dioxide",
|
| 18 |
-
"total_sulfur_dioxide",
|
| 19 |
-
"density",
|
| 20 |
-
"pH",
|
| 21 |
-
"sulphates",
|
| 22 |
-
"alcohol",
|
| 23 |
-
"quality",
|
| 24 |
-
"is_red"
|
| 25 |
-
]
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
DESCRIPTION = "Wine quality dataset."
|
| 29 |
-
_HOMEPAGE = "https://www.kaggle.com/datasets/ghassenkhaled/wine-quality-data"
|
| 30 |
-
_URLS = ("https://www.kaggle.com/datasets/ghassenkhaled/wine-quality-data")
|
| 31 |
-
_CITATION = """"""
|
| 32 |
-
|
| 33 |
-
# Dataset info
|
| 34 |
-
urls_per_split = {
|
| 35 |
-
"train": "https://huggingface.co/datasets/mstz/wine/raw/main/Wine_Quality_Data.csv",
|
| 36 |
-
}
|
| 37 |
-
features_types_per_config = {
|
| 38 |
-
"wine": {
|
| 39 |
-
"fixed_acidity": datasets.Value("float64"),
|
| 40 |
-
"volatile_acidity": datasets.Value("float64"),
|
| 41 |
-
"citric_acid": datasets.Value("float64"),
|
| 42 |
-
"residual_sugar": datasets.Value("float64"),
|
| 43 |
-
"chlorides": datasets.Value("float64"),
|
| 44 |
-
"free_sulfur_dioxide": datasets.Value("float64"),
|
| 45 |
-
"total_sulfur_dioxide": datasets.Value("float64"),
|
| 46 |
-
"density": datasets.Value("float64"),
|
| 47 |
-
"pH": datasets.Value("float64"),
|
| 48 |
-
"sulphates": datasets.Value("float64"),
|
| 49 |
-
"alcohol": datasets.Value("float64"),
|
| 50 |
-
"quality": datasets.Value("int8"),
|
| 51 |
-
"is_red": datasets.ClassLabel(num_classes=2, names=("red", "white"))
|
| 52 |
-
}
|
| 53 |
-
|
| 54 |
-
}
|
| 55 |
-
features_per_config = {k: datasets.Features(features_types_per_config[k]) for k in features_types_per_config}
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
class WineConfig(datasets.BuilderConfig):
|
| 59 |
-
def __init__(self, **kwargs):
|
| 60 |
-
super(WineConfig, self).__init__(version=VERSION, **kwargs)
|
| 61 |
-
self.features = features_per_config[kwargs["name"]]
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
class Wine(datasets.GeneratorBasedBuilder):
|
| 65 |
-
# dataset versions
|
| 66 |
-
DEFAULT_CONFIG = "wine"
|
| 67 |
-
BUILDER_CONFIGS = [
|
| 68 |
-
WineConfig(name="wine",
|
| 69 |
-
description="Binary classification."),
|
| 70 |
-
]
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
def _info(self):
|
| 74 |
-
info = datasets.DatasetInfo(description=DESCRIPTION, citation=_CITATION, homepage=_HOMEPAGE,
|
| 75 |
-
features=features_per_config[self.config.name])
|
| 76 |
-
|
| 77 |
-
return info
|
| 78 |
-
|
| 79 |
-
def _split_generators(self, dl_manager: datasets.DownloadManager) -> List[datasets.SplitGenerator]:
|
| 80 |
-
downloads = dl_manager.download_and_extract(urls_per_split)
|
| 81 |
-
|
| 82 |
-
return [
|
| 83 |
-
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloads["train"]}),
|
| 84 |
-
]
|
| 85 |
-
|
| 86 |
-
def _generate_examples(self, filepath: str):
|
| 87 |
-
data = pandas.read_csv(filepath)
|
| 88 |
-
data = self.preprocess(data, config=self.config.name)
|
| 89 |
-
|
| 90 |
-
for row_id, row in data.iterrows():
|
| 91 |
-
data_row = dict(row)
|
| 92 |
-
|
| 93 |
-
yield row_id, data_row
|
| 94 |
-
|
| 95 |
-
def preprocess(self, data: pandas.DataFrame, config: str = DEFAULT_CONFIG) -> pandas.DataFrame:
|
| 96 |
-
data = data.rename(columns={"color": "is_red"})
|
| 97 |
-
data.loc[data.is_red == "red", "is_red"] = 0
|
| 98 |
-
data.loc[data.is_red == "white", "is_red"] = 1
|
| 99 |
-
|
| 100 |
-
return data
|
| 101 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wine/train.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|