mstz commited on
Commit
1f0ab33
1 Parent(s): 7bb56a8

Upload 3 files

Browse files
Files changed (3) hide show
  1. README.md +42 -1
  2. abalone.data +0 -0
  3. abalone.py +101 -0
README.md CHANGED
@@ -1,3 +1,44 @@
1
  ---
2
- license: cc
 
 
 
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ language:
3
+ - en
4
+ tags:
5
+ - abalone
6
+ - tabular_regression
7
+ - regression
8
+ pretty_name: Abalone
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-regression
13
+ configs:
14
+ - abalone
15
  ---
16
+ # Abalone
17
+ The [Abalone dataset](https://archive.ics.uci.edu/ml/datasets/Abalone) from the [UCI ML repository](https://archive.ics.uci.edu/ml/datasets).
18
+ Predict the age of the given abalone.
19
+
20
+ # Configurations and tasks
21
+ | **Configuration** | **Task** | Description |
22
+ |-------------------|---------------------------|---------------------------------------------------------------|
23
+ | Abalon | Regression | Predict the age of the abalone. |
24
+
25
+ # Usage
26
+ ```
27
+ from datasets import load_dataset
28
+ from sklearn.tree import DecisionTreeClassifier
29
+
30
+ dataset = load_dataset("mstz/abalone", "abalone")["train"]
31
+ ```
32
+
33
+ # Features
34
+ |**Feature** |**Type** |
35
+ |-------------------|---------------|
36
+ | sex | `[string]` |
37
+ | length | `[float64]` |
38
+ | diameter | `[float64]` |
39
+ | height | `[float64]` |
40
+ | whole_weight | `[float64]` |
41
+ | shucked_weight | `[float64]` |
42
+ | viscera_weight | `[float64]` |
43
+ | shell_weight | `[float64]` |
44
+ | number_of_rings | `[int8]` |
abalone.data ADDED
The diff for this file is too large to render. See raw diff
 
abalone.py ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Abalone."""
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
+ _ORIGINAL_FEATURE_NAMES = [
13
+ "Sex",
14
+ "Length",
15
+ "Diameter",
16
+ "Height",
17
+ "Whole_weight",
18
+ "Shucked_weight",
19
+ "Viscera_weight",
20
+ "Shell_weight",
21
+ "Ring",
22
+ ]
23
+ _BASE_FEATURE_NAMES = [
24
+ "sex",
25
+ "length",
26
+ "diameter",
27
+ "height",
28
+ "whole_weight",
29
+ "shucked_weight",
30
+ "viscera_weight",
31
+ "shell_weight",
32
+ "number_of_rings",
33
+ ]
34
+
35
+ DESCRIPTION = "Abalone dataset from the UCI ML repository."
36
+ _HOMEPAGE = "https://archive.ics.uci.edu/ml/datasets/Abalone"
37
+ _URLS = ("https://huggingface.co/datasets/mstz/abalone/raw/abalone.data")
38
+ _CITATION = """
39
+ @misc{misc_abalone_1,
40
+ title = {{Abalone}},
41
+ year = {1995},
42
+ howpublished = {UCI Machine Learning Repository},
43
+ note = {{DOI}: \\url{10.24432/C55C7W}}
44
+ }"""
45
+
46
+ # Dataset info
47
+ urls_per_split = {
48
+ "train": "https://huggingface.co/datasets/mstz/abalone/raw/main/abalone.data",
49
+ }
50
+ features_types_per_config = {
51
+ "abalone": {
52
+ "sex": datasets.Value("string"),
53
+ "length": datasets.Value("float64"),
54
+ "diameter": datasets.Value("float64"),
55
+ "Height": datasets.Value("float64"),
56
+ "whole_weight": datasets.Value("float64"),
57
+ "shucked_weight": datasets.Value("float64"),
58
+ "viscera_weight": datasets.Value("float64"),
59
+ "shell_weight": datasets.Value("float64"),
60
+ "ring": datasets.Value("int8")
61
+ }
62
+ }
63
+ features_per_config = {k: datasets.Features(features_types_per_config[k]) for k in features_types_per_config}
64
+
65
+
66
+ class AbaloneConfig(datasets.BuilderConfig):
67
+ def __init__(self, **kwargs):
68
+ super(AbaloneConfig, self).__init__(version=VERSION, **kwargs)
69
+ self.features = features_per_config[kwargs["name"]]
70
+
71
+
72
+ class Abalone(datasets.GeneratorBasedBuilder):
73
+ # dataset versions
74
+ DEFAULT_CONFIG = "abalone"
75
+ BUILDER_CONFIGS = [
76
+ AbaloneConfig(name="abalone",
77
+ description="Abalone for regression."),
78
+ ]
79
+
80
+
81
+ def _info(self):
82
+ info = datasets.DatasetInfo(description=DESCRIPTION, citation=_CITATION, homepage=_HOMEPAGE,
83
+ features=features_per_config[self.config.name])
84
+
85
+ return info
86
+
87
+ def _split_generators(self, dl_manager: datasets.DownloadManager) -> List[datasets.SplitGenerator]:
88
+ downloads = dl_manager.download_and_extract(urls_per_split)
89
+
90
+ return [
91
+ datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloads["train"]})
92
+ ]
93
+
94
+ def _generate_examples(self, filepath: str):
95
+ data = pandas.read_csv(filepath, header=None)
96
+ data.columns = _BASE_FEATURE_NAMES
97
+
98
+ for row_id, row in data.iterrows():
99
+ data_row = dict(row)
100
+
101
+ yield row_id, data_row