mstz commited on
Commit
d6672f2
1 Parent(s): 35f32a2

Update balloons.py

Browse files
Files changed (1) hide show
  1. balloons.py +6 -8
balloons.py CHANGED
@@ -1,5 +1,3 @@
1
- """Balloons."""
2
-
3
  from typing import List
4
 
5
  import datasets
@@ -13,7 +11,7 @@ _BASE_FEATURE_NAMES = [
13
  "size",
14
  "act",
15
  "age",
16
- "inflated"
17
  ]
18
 
19
 
@@ -40,28 +38,28 @@ features_types_per_config = {
40
  "size": datasets.Value("string"),
41
  "act": datasets.Value("string"),
42
  "age": datasets.Value("string"),
43
- "inflated": datasets.ClassLabel(num_classes=2)
44
  },
45
  "adult_and_stretch": {
46
  "color": datasets.Value("string"),
47
  "size": datasets.Value("string"),
48
  "act": datasets.Value("string"),
49
  "age": datasets.Value("string"),
50
- "inflated": datasets.ClassLabel(num_classes=2)
51
  },
52
  "yellow_and_small": {
53
  "color": datasets.Value("string"),
54
  "size": datasets.Value("string"),
55
  "act": datasets.Value("string"),
56
  "age": datasets.Value("string"),
57
- "inflated": datasets.ClassLabel(num_classes=2)
58
  },
59
  "yellow_and_small_or_adult_and_stretch": {
60
  "color": datasets.Value("string"),
61
  "size": datasets.Value("string"),
62
  "act": datasets.Value("string"),
63
  "age": datasets.Value("string"),
64
- "inflated": datasets.ClassLabel(num_classes=2)
65
  }
66
  }
67
  features_per_config = {k: datasets.Features(features_types_per_config[k]) for k in features_types_per_config}
@@ -104,7 +102,7 @@ class Balloons(datasets.GeneratorBasedBuilder):
104
  def _generate_examples(self, filepath: str):
105
  data = pandas.read_csv(filepath, header=None)
106
  data.columns = _BASE_FEATURE_NAMES
107
- data.loc[:, "inflated"] = data.inflated.apply(lambda x: 1 if x == "T" else 0)
108
 
109
  for row_id, row in data.iterrows():
110
  data_row = dict(row)
 
 
 
1
  from typing import List
2
 
3
  import datasets
 
11
  "size",
12
  "act",
13
  "age",
14
+ "is_inflated"
15
  ]
16
 
17
 
 
38
  "size": datasets.Value("string"),
39
  "act": datasets.Value("string"),
40
  "age": datasets.Value("string"),
41
+ "is_inflated": datasets.ClassLabel(num_classes=2)
42
  },
43
  "adult_and_stretch": {
44
  "color": datasets.Value("string"),
45
  "size": datasets.Value("string"),
46
  "act": datasets.Value("string"),
47
  "age": datasets.Value("string"),
48
+ "is_inflated": datasets.ClassLabel(num_classes=2)
49
  },
50
  "yellow_and_small": {
51
  "color": datasets.Value("string"),
52
  "size": datasets.Value("string"),
53
  "act": datasets.Value("string"),
54
  "age": datasets.Value("string"),
55
+ "is_inflated": datasets.ClassLabel(num_classes=2)
56
  },
57
  "yellow_and_small_or_adult_and_stretch": {
58
  "color": datasets.Value("string"),
59
  "size": datasets.Value("string"),
60
  "act": datasets.Value("string"),
61
  "age": datasets.Value("string"),
62
+ "is_inflated": datasets.ClassLabel(num_classes=2)
63
  }
64
  }
65
  features_per_config = {k: datasets.Features(features_types_per_config[k]) for k in features_types_per_config}
 
102
  def _generate_examples(self, filepath: str):
103
  data = pandas.read_csv(filepath, header=None)
104
  data.columns = _BASE_FEATURE_NAMES
105
+ data.loc[:, "is_inflated"] = data.inflated.apply(lambda x: 1 if x == "T" else 0)
106
 
107
  for row_id, row in data.iterrows():
108
  data_row = dict(row)