mstz commited on
Commit
fde2d1d
·
1 Parent(s): f4b657c

Upload 2 files

Browse files
Files changed (2) hide show
  1. README.md +14 -14
  2. adult.py +21 -0
README.md CHANGED
@@ -28,17 +28,17 @@ The dataset has four configurations:
28
  - `race`, multiclass classification to predict the `race` of the individual.
29
 
30
  # Features
31
- - `age` Age of the person;
32
- - `capital_gain` Capital gained by the person;
33
- - `capital_loss` Capital lost by the person;
34
- - `education` Education level: the higher, the more educated the person;
35
- - `final_weight`
36
- - `hours_per_week` Hours worked per week;
37
- - `marital_status` Marital status of the person;
38
- - `native_country` Native country of the person;
39
- - `occupation` Job of the person;
40
- - `race` Race of the person;
41
- - `relationship`
42
- - `sex` Sex of the person;
43
- - `workclass` Type of job of the person;
44
- - `over_threshold` `1` for income `>= 50k$`, `0` otherwise.
 
28
  - `race`, multiclass classification to predict the `race` of the individual.
29
 
30
  # Features
31
+ - `age` `[int64]` Age of the person;
32
+ - `capital_gain` `[float64]` Capital gained by the person;
33
+ - `capital_loss` `[float64]` Capital lost by the person;
34
+ - `education` `[int8]` Education level: the higher, the more educated the person;
35
+ - `final_weight` `[int64]`
36
+ - `hours_per_week` `[int64]` Hours worked per week;
37
+ - `marital_status` `[string]` Marital status of the person;
38
+ - `native_country` `[string]` Native country of the person;
39
+ - `occupation` `[string]` Job of the person;
40
+ - `race` `[string]` Race of the person;
41
+ - `relationship` `[string]`
42
+ - `sex` `[int8]` Sex of the person;
43
+ - `workclass` `[string]` Type of job of the person;
44
+ - `over_threshold` `int8` `1` for income `>= 50k$`, `0` otherwise.
adult.py CHANGED
@@ -55,6 +55,24 @@ _RACE_ENCODING = {
55
  "Amer-Indian-Eskimo": 3,
56
  "Other": 4,
57
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
 
59
  DESCRIPTION = "Adult dataset from the UCI ML repository."
60
  _HOMEPAGE = "https://archive.ics.uci.edu/ml/datasets/Adult"
@@ -207,6 +225,9 @@ class Adult(datasets.GeneratorBasedBuilder):
207
  data.append(pandas.DataFrame([("race", original_value, encoded_value)
208
  for original_value, encoded_value in _RACE_ENCODING.items()],
209
  columns=["feature", "original_value", "encoded_value"]))
 
 
 
210
  data = pandas.concat(data, axis="rows").reset_index()
211
  data.drop("index", axis="columns", inplace=True)
212
 
 
55
  "Amer-Indian-Eskimo": 3,
56
  "Other": 4,
57
  }
58
+ _EDUCATION_ENCODING = {
59
+ "Preschool": 0,
60
+ "1st-4th": 1,
61
+ "5th-6th": 2,
62
+ "7th-8th": 3,
63
+ "9th": 4,
64
+ "10th": 5,
65
+ "11th": 6,
66
+ "12th": 7,
67
+ "HS-grad": 8,
68
+ "Assoc-acdm": 9,
69
+ "Assoc-voc": 10,
70
+ "Some-college": 11,
71
+ "Bachelors": 12,
72
+ "Masters": 13,
73
+ "Doctorate": 14,
74
+ "Prof-school": 15
75
+ }
76
 
77
  DESCRIPTION = "Adult dataset from the UCI ML repository."
78
  _HOMEPAGE = "https://archive.ics.uci.edu/ml/datasets/Adult"
 
225
  data.append(pandas.DataFrame([("race", original_value, encoded_value)
226
  for original_value, encoded_value in _RACE_ENCODING.items()],
227
  columns=["feature", "original_value", "encoded_value"]))
228
+ data.append(pandas.DataFrame([("education", original_value, encoded_value)
229
+ for original_value, encoded_value in _EDUCATION_ENCODING.items()],
230
+ columns=["feature", "original_value", "encoded_value"]))
231
  data = pandas.concat(data, axis="rows").reset_index()
232
  data.drop("index", axis="columns", inplace=True)
233