parquet-converter commited on
Commit
2ca3d54
·
1 Parent(s): abbc9b0

Update parquet files

Browse files
Files changed (4) hide show
  1. README.md +0 -21
  2. golf.data +0 -15
  3. golf.py +0 -90
  4. golf/golf-train.parquet +3 -0
README.md DELETED
@@ -1,21 +0,0 @@
1
- ---
2
- language:
3
- - en
4
- tags:
5
- - golf
6
- - tabular_classification
7
- - binary_classification
8
- pretty_name: Golf
9
- task_categories: # Full list at https://github.com/huggingface/hub-docs/blob/main/js/src/lib/interfaces/Types.ts
10
- - tabular-classification
11
- configs:
12
- - golf
13
- ---
14
- # Golf
15
- The Golf dataset.
16
- Is it a good day to play golf?
17
-
18
- # Configurations and tasks
19
- | **Configuration** | **Task** |
20
- |-----------------------|---------------------------|
21
- | golf | Binary classification.|
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
golf.data DELETED
@@ -1,15 +0,0 @@
1
- outlook,temperature,humidity,windy,goodPlaying,toPlay
2
- sunny,85,85,false,1,Don't Play
3
- sunny,80,90,true,1,Don't Play
4
- overcast,83,78,false,1.5,Play
5
- rain,70,96,false,0.8,Play
6
- rain,68,80,false,2,Play
7
- rain,65,70,true,1,Don't Play
8
- overcast,64,65,true,2.5,Play
9
- sunny,72,95,false,1,Don't Play
10
- sunny,69,70,false,1,Play
11
- rain,75,80,false,1.5,Play
12
- sunny,75,70,true,3,Play
13
- overcast,72,90,true,1.5,Play
14
- overcast,81,75,false,1,Play
15
- rain,71,80,true,1,Don't Play
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
golf.py DELETED
@@ -1,90 +0,0 @@
1
- """Golf 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
- "toPlay": {
15
- "Don't Play": 0,
16
- "Play": 1
17
- }
18
- }
19
-
20
- DESCRIPTION = "Golf dataset."
21
- _HOMEPAGE = ""
22
- _URLS = ("")
23
- _CITATION = """"""
24
-
25
- # Dataset info
26
- urls_per_split = {
27
- "train": "https://huggingface.co/datasets/mstz/golf/resolve/main/golf.data"
28
- }
29
- features_types_per_config = {
30
- "golf": {
31
- "outlook": datasets.Value("string"),
32
- "temperature": datasets.Value("int8"),
33
- "humidity": datasets.Value("int8"),
34
- "windy": datasets.Value("bool"),
35
- "goodPlaying": datasets.Value("float64"),
36
- "toPlay": datasets.ClassLabel(num_classes=2, names=("no", "yes"))
37
- }
38
- }
39
- features_per_config = {k: datasets.Features(features_types_per_config[k]) for k in features_types_per_config}
40
-
41
-
42
- class GolfConfig(datasets.BuilderConfig):
43
- def __init__(self, **kwargs):
44
- super(GolfConfig, self).__init__(version=VERSION, **kwargs)
45
- self.features = features_per_config[kwargs["name"]]
46
-
47
-
48
- class Golf(datasets.GeneratorBasedBuilder):
49
- # dataset versions
50
- DEFAULT_CONFIG = "golf"
51
- BUILDER_CONFIGS = [
52
- GolfConfig(name="golf", description="Golf for binary classification.")
53
- ]
54
-
55
-
56
- def _info(self):
57
- info = datasets.DatasetInfo(description=DESCRIPTION, citation=_CITATION, homepage=_HOMEPAGE,
58
- features=features_per_config[self.config.name])
59
-
60
- return info
61
-
62
- def _split_generators(self, dl_manager: datasets.DownloadManager) -> List[datasets.SplitGenerator]:
63
- downloads = dl_manager.download_and_extract(urls_per_split)
64
-
65
- return [
66
- datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloads["train"]}),
67
- ]
68
-
69
- def _generate_examples(self, filepath: str):
70
- data = pandas.read_csv(filepath)
71
- data = self.preprocess(data)
72
-
73
- for row_id, row in data.iterrows():
74
- data_row = dict(row)
75
-
76
- yield row_id, data_row
77
-
78
- def preprocess(self, data: pandas.DataFrame) -> pandas.DataFrame:
79
- print(data.dtypes)
80
- print(data.windy.unique())
81
- for feature in _ENCODING_DICS:
82
- encoding_function = partial(self.encode, feature)
83
- data.loc[:, feature] = data[feature].apply(encoding_function)
84
-
85
- return data[list(features_types_per_config[self.config.name].keys())]
86
-
87
- def encode(self, feature, value):
88
- if feature in _ENCODING_DICS:
89
- return _ENCODING_DICS[feature][value]
90
- raise ValueError(f"Unknown feature: {feature}")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
golf/golf-train.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c47e7b6a1788f7216d1e7d02be242236ed733bb489d1fadd34177d6976e0d5a3
3
+ size 3268