mstz commited on
Commit
3f7aee9
·
1 Parent(s): 56bbaf9

updated to datasets 4.*

Browse files
Files changed (4) hide show
  1. README.md +17 -13
  2. abalone.py +0 -116
  3. abalone.data → abalone/train.csv +4 -3
  4. binary/train.csv +0 -0
README.md CHANGED
@@ -1,21 +1,25 @@
1
  ---
2
- language:
3
- - en
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  tags:
5
- - abalone
6
- - tabular_regression
7
- - regression
8
  - binary_classification
9
- pretty_name: Abalone
10
- size_categories:
11
- - 1K<n<10K
12
  task_categories:
13
- - tabular-regression
14
  - tabular-classification
15
- configs:
16
- - abalone
17
- - binary
18
- license: cc
19
  ---
20
  # Abalone
21
  The [Abalone dataset](https://archive-beta.ics.uci.edu/dataset/1/abalone) from the [UCI ML repository](https://archive.ics.uci.edu/ml/datasets).
 
1
  ---
2
+ configs:
3
+ - config_name: abalone
4
+ data_files:
5
+ - path: abalone/train.csv
6
+ split: train
7
+ default: true
8
+ - config_name: binary
9
+ data_files:
10
+ - path: binary/train.csv
11
+ split: train
12
+ default: false
13
+ language: en
14
+ license: cc
15
+ pretty_name: Abalone
16
+ size_categories: 1M<n<10M
17
  tags:
18
+ - tabular_classification
 
 
19
  - binary_classification
20
+ - multiclass_classification
 
 
21
  task_categories:
 
22
  - tabular-classification
 
 
 
 
23
  ---
24
  # Abalone
25
  The [Abalone dataset](https://archive-beta.ics.uci.edu/dataset/1/abalone) from the [UCI ML repository](https://archive.ics.uci.edu/ml/datasets).
abalone.py DELETED
@@ -1,116 +0,0 @@
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
- "number_of_rings": datasets.Value("int8")
61
- },
62
- "binary": {
63
- "sex": datasets.Value("string"),
64
- "length": datasets.Value("float64"),
65
- "diameter": datasets.Value("float64"),
66
- "height": datasets.Value("float64"),
67
- "whole_weight": datasets.Value("float64"),
68
- "shucked_weight": datasets.Value("float64"),
69
- "viscera_weight": datasets.Value("float64"),
70
- "shell_weight": datasets.Value("float64"),
71
- "is_old": datasets.ClassLabel(num_classes=2)
72
- }
73
- }
74
- features_per_config = {k: datasets.Features(features_types_per_config[k]) for k in features_types_per_config}
75
-
76
-
77
- class AbaloneConfig(datasets.BuilderConfig):
78
- def __init__(self, **kwargs):
79
- super(AbaloneConfig, self).__init__(version=VERSION, **kwargs)
80
- self.features = features_per_config[kwargs["name"]]
81
-
82
-
83
- class Abalone(datasets.GeneratorBasedBuilder):
84
- # dataset versions
85
- DEFAULT_CONFIG = "abalone"
86
- BUILDER_CONFIGS = [
87
- AbaloneConfig(name="abalone", description="Abalone for regression."),
88
- AbaloneConfig(name="binary", description="Abalone for binary classification."),
89
- ]
90
-
91
-
92
- def _info(self):
93
- info = datasets.DatasetInfo(description=DESCRIPTION, citation=_CITATION, homepage=_HOMEPAGE,
94
- features=features_per_config[self.config.name])
95
-
96
- return info
97
-
98
- def _split_generators(self, dl_manager: datasets.DownloadManager) -> List[datasets.SplitGenerator]:
99
- downloads = dl_manager.download_and_extract(urls_per_split)
100
-
101
- return [
102
- datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloads["train"]})
103
- ]
104
-
105
- def _generate_examples(self, filepath: str):
106
- data = pandas.read_csv(filepath, header=None)
107
- data.columns = _BASE_FEATURE_NAMES
108
-
109
- if self.config.name == "binary":
110
- data = data.rename(columns={"number_of_rings": "is_old"})
111
- data["is_old"] = data["is_old"].apply(lambda x: 1 if x > 9 else 0)
112
-
113
- for row_id, row in data.iterrows():
114
- data_row = dict(row)
115
-
116
- yield row_id, data_row
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
abalone.data → abalone/train.csv RENAMED
@@ -1,3 +1,4 @@
 
1
  M,0.455,0.365,0.095,0.514,0.2245,0.101,0.15,15
2
  M,0.35,0.265,0.09,0.2255,0.0995,0.0485,0.07,7
3
  F,0.53,0.42,0.135,0.677,0.2565,0.1415,0.21,9
@@ -1255,7 +1256,7 @@ I,0.42,0.305,0.09,0.328,0.168,0.0615,0.082,6
1255
  I,0.425,0.325,0.11,0.3335,0.173,0.045,0.1,7
1256
  I,0.425,0.32,0.1,0.3055,0.126,0.06,0.106,7
1257
  I,0.425,0.31,0.09,0.301,0.1385,0.065,0.08,7
1258
- I,0.43,0.34,0,0.428,0.2065,0.086,0.115,8
1259
  I,0.43,0.315,0.095,0.378,0.175,0.08,0.1045,8
1260
  I,0.435,0.315,0.11,0.3685,0.1615,0.0715,0.12,7
1261
  I,0.44,0.34,0.12,0.438,0.2115,0.083,0.12,9
@@ -1366,7 +1367,7 @@ M,0.61,0.48,0.165,1.244,0.6345,0.257,0.305,12
1366
  M,0.61,0.475,0.17,1.0265,0.435,0.2335,0.3035,10
1367
  I,0.61,0.465,0.15,0.9605,0.4495,0.1725,0.286,9
1368
  M,0.61,0.48,0.17,1.137,0.4565,0.29,0.347,10
1369
- M,0.61,0.46,0.16,1,0.494,0.197,0.275,10
1370
  F,0.615,0.475,0.155,1.004,0.4475,0.193,0.2895,10
1371
  M,0.615,0.47,0.165,1.128,0.4465,0.2195,0.34,10
1372
  M,0.615,0.5,0.17,1.054,0.4845,0.228,0.295,10
@@ -3994,7 +3995,7 @@ M,0.7,0.6,0.23,2.003,0.8105,0.4045,0.5755,10
3994
  M,0.72,0.6,0.235,2.2385,0.984,0.411,0.621,12
3995
  I,0.185,0.135,0.045,0.032,0.011,0.0065,0.01,4
3996
  I,0.245,0.175,0.055,0.0785,0.04,0.018,0.02,5
3997
- I,0.315,0.23,0,0.134,0.0575,0.0285,0.3505,6
3998
  I,0.36,0.27,0.09,0.2075,0.098,0.039,0.062,6
3999
  I,0.375,0.28,0.08,0.2235,0.115,0.043,0.055,6
4000
  I,0.415,0.31,0.095,0.34,0.181,0.057,0.083,6
 
1
+ sex,length,diameter,height,whole_weight,shucked_weight,viscera_weight,shell_weight,number_of_rings
2
  M,0.455,0.365,0.095,0.514,0.2245,0.101,0.15,15
3
  M,0.35,0.265,0.09,0.2255,0.0995,0.0485,0.07,7
4
  F,0.53,0.42,0.135,0.677,0.2565,0.1415,0.21,9
 
1256
  I,0.425,0.325,0.11,0.3335,0.173,0.045,0.1,7
1257
  I,0.425,0.32,0.1,0.3055,0.126,0.06,0.106,7
1258
  I,0.425,0.31,0.09,0.301,0.1385,0.065,0.08,7
1259
+ I,0.43,0.34,0.0,0.428,0.2065,0.086,0.115,8
1260
  I,0.43,0.315,0.095,0.378,0.175,0.08,0.1045,8
1261
  I,0.435,0.315,0.11,0.3685,0.1615,0.0715,0.12,7
1262
  I,0.44,0.34,0.12,0.438,0.2115,0.083,0.12,9
 
1367
  M,0.61,0.475,0.17,1.0265,0.435,0.2335,0.3035,10
1368
  I,0.61,0.465,0.15,0.9605,0.4495,0.1725,0.286,9
1369
  M,0.61,0.48,0.17,1.137,0.4565,0.29,0.347,10
1370
+ M,0.61,0.46,0.16,1.0,0.494,0.197,0.275,10
1371
  F,0.615,0.475,0.155,1.004,0.4475,0.193,0.2895,10
1372
  M,0.615,0.47,0.165,1.128,0.4465,0.2195,0.34,10
1373
  M,0.615,0.5,0.17,1.054,0.4845,0.228,0.295,10
 
3995
  M,0.72,0.6,0.235,2.2385,0.984,0.411,0.621,12
3996
  I,0.185,0.135,0.045,0.032,0.011,0.0065,0.01,4
3997
  I,0.245,0.175,0.055,0.0785,0.04,0.018,0.02,5
3998
+ I,0.315,0.23,0.0,0.134,0.0575,0.0285,0.3505,6
3999
  I,0.36,0.27,0.09,0.2075,0.098,0.039,0.062,6
4000
  I,0.375,0.28,0.08,0.2235,0.115,0.043,0.055,6
4001
  I,0.415,0.31,0.095,0.34,0.181,0.057,0.083,6
binary/train.csv ADDED
The diff for this file is too large to render. See raw diff