Kossisoroyce commited on
Commit
91fdf7b
·
verified ·
1 Parent(s): 4ed6895

Initial upload: African physiognomy-adjusted breast cancer dataset

Browse files
Files changed (2) hide show
  1. README.md +1 -0
  2. dataset.py +130 -0
README.md CHANGED
@@ -2,6 +2,7 @@
2
  license: cc-by-4.0
3
  task_categories:
4
  - tabular-classification
 
5
  language:
6
  - en
7
  tags:
 
2
  license: cc-by-4.0
3
  task_categories:
4
  - tabular-classification
5
+ - medical
6
  language:
7
  - en
8
  tags:
dataset.py ADDED
@@ -0,0 +1,130 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Breast Cancer Wisconsin Dataset: African Physiognomy Adjusted"""
2
+
3
+ import csv
4
+ import datasets
5
+
6
+ _CITATION = """\
7
+ @misc{udodi2025breast,
8
+ title={Addressing Representation Bias in Breast Cancer Datasets: A Physiognomy-Informed Approach for African Populations},
9
+ author={Kossiso Udodi Royce},
10
+ year={2025},
11
+ publisher={Electric Sheep Africa},
12
+ url={https://huggingface.co/datasets/ElectricSheepAfrica/breast-cancer-african-adjusted}
13
+ }
14
+ """
15
+
16
+ _DESCRIPTION = """\
17
+ This dataset addresses representation bias in medical AI by providing an African physiognomy-adjusted
18
+ version of the classic Wisconsin Breast Cancer Dataset. The adjustment methodology systematically
19
+ modifies cellular morphology features to better reflect documented physiological differences in
20
+ African populations.
21
+
22
+ Key adjustments include:
23
+ - Higher breast density (5-8% increase in size/texture features)
24
+ - Enhanced irregularity (12-19% increase in concavity/fractal features)
25
+ - Reduced boundary smoothness (10-12% decrease in smoothness/symmetry)
26
+
27
+ The dataset contains 569 samples with 30 morphological features from Fine Needle Aspirate (FNA)
28
+ samples, classified as Malignant (M) or Benign (B).
29
+ """
30
+
31
+ _HOMEPAGE = "https://huggingface.co/datasets/ElectricSheepAfrica/breast-cancer-african-adjusted"
32
+
33
+ _LICENSE = "CC BY 4.0"
34
+
35
+ _URLS = {
36
+ "african_adjusted": "breast_cancer_african_adjusted.csv",
37
+ "wisconsin_breast_cancer_dataset": "breast_cancer_original.csv",
38
+ }
39
+
40
+ class BreastCancerAfricanAdjusted(datasets.GeneratorBasedBuilder):
41
+ """Breast Cancer Wisconsin Dataset with African Physiognomy Adjustments"""
42
+
43
+ VERSION = datasets.Version("1.1.0")
44
+
45
+ BUILDER_CONFIGS = [
46
+ datasets.BuilderConfig(
47
+ name="african_adjusted",
48
+ version=VERSION,
49
+ description="African physiognomy-adjusted breast cancer dataset",
50
+ ),
51
+ datasets.BuilderConfig(
52
+ name="wisconsin_breast_cancer_dataset",
53
+ version=VERSION,
54
+ description="Original Wisconsin breast cancer dataset",
55
+ ),
56
+ ]
57
+
58
+ DEFAULT_CONFIG_NAME = "african_adjusted"
59
+
60
+ def _info(self):
61
+ features = datasets.Features({
62
+ "id": datasets.Value("float64"),
63
+ "diagnosis": datasets.Value("string"),
64
+ "radius_mean": datasets.Value("float64"),
65
+ "texture_mean": datasets.Value("float64"),
66
+ "perimeter_mean": datasets.Value("float64"),
67
+ "area_mean": datasets.Value("float64"),
68
+ "smoothness_mean": datasets.Value("float64"),
69
+ "compactness_mean": datasets.Value("float64"),
70
+ "concavity_mean": datasets.Value("float64"),
71
+ "concave points_mean": datasets.Value("float64"),
72
+ "symmetry_mean": datasets.Value("float64"),
73
+ "fractal_dimension_mean": datasets.Value("float64"),
74
+ "radius_se": datasets.Value("float64"),
75
+ "texture_se": datasets.Value("float64"),
76
+ "perimeter_se": datasets.Value("float64"),
77
+ "area_se": datasets.Value("float64"),
78
+ "smoothness_se": datasets.Value("float64"),
79
+ "compactness_se": datasets.Value("float64"),
80
+ "concavity_se": datasets.Value("float64"),
81
+ "concave points_se": datasets.Value("float64"),
82
+ "symmetry_se": datasets.Value("float64"),
83
+ "fractal_dimension_se": datasets.Value("float64"),
84
+ "radius_worst": datasets.Value("float64"),
85
+ "texture_worst": datasets.Value("float64"),
86
+ "perimeter_worst": datasets.Value("float64"),
87
+ "area_worst": datasets.Value("float64"),
88
+ "smoothness_worst": datasets.Value("float64"),
89
+ "compactness_worst": datasets.Value("float64"),
90
+ "concavity_worst": datasets.Value("float64"),
91
+ "concave points_worst": datasets.Value("float64"),
92
+ "symmetry_worst": datasets.Value("float64"),
93
+ "fractal_dimension_worst": datasets.Value("float64"),
94
+ })
95
+
96
+ return datasets.DatasetInfo(
97
+ description=_DESCRIPTION,
98
+ features=features,
99
+ homepage=_HOMEPAGE,
100
+ license=_LICENSE,
101
+ citation=_CITATION,
102
+ )
103
+
104
+ def _split_generators(self, dl_manager):
105
+ urls = _URLS[self.config.name]
106
+ data_file = dl_manager.download_and_extract(urls)
107
+
108
+ return [
109
+ datasets.SplitGenerator(
110
+ name=datasets.Split.TRAIN,
111
+ gen_kwargs={
112
+ "filepath": data_file,
113
+ "split": "train",
114
+ },
115
+ ),
116
+ ]
117
+
118
+ def _generate_examples(self, filepath, split):
119
+ with open(filepath, encoding="utf-8") as f:
120
+ reader = csv.DictReader(f)
121
+ for key, row in enumerate(reader):
122
+ # Convert numeric fields
123
+ for field in row:
124
+ if field != "diagnosis":
125
+ try:
126
+ row[field] = float(row[field])
127
+ except (ValueError, TypeError):
128
+ row[field] = None
129
+
130
+ yield key, row