mstz commited on
Commit
8d75003
1 Parent(s): 0139bba

Update breast.py

Browse files
Files changed (1) hide show
  1. breast.py +4 -7
breast.py CHANGED
@@ -83,7 +83,7 @@ class Breast(datasets.GeneratorBasedBuilder):
83
  DEFAULT_CONFIG = "cancer"
84
  BUILDER_CONFIGS = [
85
  BreastConfig(name="cancer",
86
- description="Encoding dictionaries for discrete features."),
87
  ]
88
 
89
 
@@ -118,13 +118,10 @@ class Breast(datasets.GeneratorBasedBuilder):
118
  data.drop("id", axis="columns", inplace=True)
119
 
120
  data = data[data.bare_nuclei != "?"]
121
- for c in data.columns:
122
- data.loc[:, c] = data[c].astype(int)
123
 
124
  data.columns = _BASE_FEATURE_NAMES
125
  data.loc[:, "is_cancer"] = data.is_cancer.apply(lambda x: 0 if x == 2 else 1)
126
 
127
- if config == "cancer":
128
- return data
129
- else:
130
- raise ValueError(f"Unknown config: {config}")
 
83
  DEFAULT_CONFIG = "cancer"
84
  BUILDER_CONFIGS = [
85
  BreastConfig(name="cancer",
86
+ description="Breast cancer binary classification."),
87
  ]
88
 
89
 
 
118
  data.drop("id", axis="columns", inplace=True)
119
 
120
  data = data[data.bare_nuclei != "?"]
121
+ data = data.astype({f: int for f in data.columns})
 
122
 
123
  data.columns = _BASE_FEATURE_NAMES
124
  data.loc[:, "is_cancer"] = data.is_cancer.apply(lambda x: 0 if x == 2 else 1)
125
 
126
+
127
+ return data