Datasets:
Upload acute_inflammation.py
Browse files- acute_inflammation.py +7 -3
acute_inflammation.py
CHANGED
@@ -16,7 +16,8 @@ _BASE_FEATURE_NAMES = [
|
|
16 |
"has_micturition_pains",
|
17 |
"has_burnt_urethra",
|
18 |
"has_inflammed_bladder",
|
19 |
-
"has_nephritis_of_renal_pelvis"
|
|
|
20 |
]
|
21 |
|
22 |
DESCRIPTION = "Acute_Inflammation dataset from the UCI ML repository."
|
@@ -44,7 +45,8 @@ features_types_per_config = {
|
|
44 |
"has_micturition_pains": datasets.Value("bool"),
|
45 |
"has_burnt_urethra": datasets.Value("bool"),
|
46 |
"has_inflammed_bladder": datasets.Value("bool"),
|
47 |
-
"has_nephritis_of_renal_pelvis": datasets.Value("
|
|
|
48 |
}
|
49 |
}
|
50 |
features_per_config = {k: datasets.Features(features_types_per_config[k]) for k in features_types_per_config}
|
@@ -90,10 +92,12 @@ class Acute_Inflammation(datasets.GeneratorBasedBuilder):
|
|
90 |
def preprocess(self, data: pandas.DataFrame, config: str = DEFAULT_CONFIG) -> pandas.DataFrame:
|
91 |
data.columns = _BASE_FEATURE_NAMES
|
92 |
boolean_features = ["has_nausea", "has_lumbar_pain", "has_urine_pushing",
|
93 |
-
"has_micturition_pains", "has_burnt_urethra", "has_inflammed_bladder"
|
|
|
94 |
for f in boolean_features:
|
95 |
data.loc[:, f] = data[f].apply(lambda x: True if x == "yes" else False)
|
96 |
|
97 |
data = data.astype({f: "bool" for f in boolean_features})
|
|
|
98 |
|
99 |
return data
|
|
|
16 |
"has_micturition_pains",
|
17 |
"has_burnt_urethra",
|
18 |
"has_inflammed_bladder",
|
19 |
+
"has_nephritis_of_renal_pelvis",
|
20 |
+
"has_acute_inflammation"
|
21 |
]
|
22 |
|
23 |
DESCRIPTION = "Acute_Inflammation dataset from the UCI ML repository."
|
|
|
45 |
"has_micturition_pains": datasets.Value("bool"),
|
46 |
"has_burnt_urethra": datasets.Value("bool"),
|
47 |
"has_inflammed_bladder": datasets.Value("bool"),
|
48 |
+
"has_nephritis_of_renal_pelvis": datasets.Value("bool"),
|
49 |
+
"has_acute_inflammation": datasets.ClassLabel(num_classes=2)
|
50 |
}
|
51 |
}
|
52 |
features_per_config = {k: datasets.Features(features_types_per_config[k]) for k in features_types_per_config}
|
|
|
92 |
def preprocess(self, data: pandas.DataFrame, config: str = DEFAULT_CONFIG) -> pandas.DataFrame:
|
93 |
data.columns = _BASE_FEATURE_NAMES
|
94 |
boolean_features = ["has_nausea", "has_lumbar_pain", "has_urine_pushing",
|
95 |
+
"has_micturition_pains", "has_burnt_urethra", "has_inflammed_bladder",
|
96 |
+
"has_nephritis_of_renal_pelvis", "has_acute_inflammation"]
|
97 |
for f in boolean_features:
|
98 |
data.loc[:, f] = data[f].apply(lambda x: True if x == "yes" else False)
|
99 |
|
100 |
data = data.astype({f: "bool" for f in boolean_features})
|
101 |
+
data = data.astype({"has_acute_inflammation": int})
|
102 |
|
103 |
return data
|