|
|
"""Breast Cancer Wisconsin Dataset: African Physiognomy Adjusted""" |
|
|
|
|
|
import csv |
|
|
import datasets |
|
|
|
|
|
_CITATION = """\ |
|
|
@misc{udodi2025breast, |
|
|
title={Addressing Representation Bias in Breast Cancer Datasets: A Physiognomy-Informed Approach for African Populations}, |
|
|
author={Kossiso Udodi Royce}, |
|
|
year={2025}, |
|
|
publisher={Electric Sheep Africa}, |
|
|
url={https://huggingface.co/datasets/ElectricSheepAfrica/breast-cancer-african-adjusted} |
|
|
} |
|
|
""" |
|
|
|
|
|
_DESCRIPTION = """\ |
|
|
This dataset addresses representation bias in medical AI by providing an African physiognomy-adjusted |
|
|
version of the classic Wisconsin Breast Cancer Dataset. The adjustment methodology systematically |
|
|
modifies cellular morphology features to better reflect documented physiological differences in |
|
|
African populations. |
|
|
|
|
|
Key adjustments include: |
|
|
- Higher breast density (5-8% increase in size/texture features) |
|
|
- Enhanced irregularity (12-19% increase in concavity/fractal features) |
|
|
- Reduced boundary smoothness (10-12% decrease in smoothness/symmetry) |
|
|
|
|
|
The dataset contains 569 samples with 30 morphological features from Fine Needle Aspirate (FNA) |
|
|
samples, classified as Malignant (M) or Benign (B). |
|
|
""" |
|
|
|
|
|
_HOMEPAGE = "https://huggingface.co/datasets/ElectricSheepAfrica/breast-cancer-african-adjusted" |
|
|
|
|
|
_LICENSE = "CC BY 4.0" |
|
|
|
|
|
_URLS = { |
|
|
"african_adjusted": "breast_cancer_african_adjusted.csv", |
|
|
"wisconsin_breast_cancer_dataset": "breast_cancer_original.csv", |
|
|
} |
|
|
|
|
|
class BreastCancerAfricanAdjusted(datasets.GeneratorBasedBuilder): |
|
|
"""Breast Cancer Wisconsin Dataset with African Physiognomy Adjustments""" |
|
|
|
|
|
VERSION = datasets.Version("1.0.2") |
|
|
|
|
|
BUILDER_CONFIGS = [ |
|
|
datasets.BuilderConfig( |
|
|
name="african_adjusted", |
|
|
version=VERSION, |
|
|
description="African physiognomy-adjusted breast cancer dataset", |
|
|
), |
|
|
datasets.BuilderConfig( |
|
|
name="wisconsin_breast_cancer_dataset", |
|
|
version=VERSION, |
|
|
description="Original Wisconsin breast cancer dataset", |
|
|
), |
|
|
] |
|
|
|
|
|
DEFAULT_CONFIG_NAME = "african_adjusted" |
|
|
|
|
|
def _info(self): |
|
|
features = datasets.Features({ |
|
|
"id": datasets.Value("float64"), |
|
|
"diagnosis": datasets.Value("string"), |
|
|
"radius_mean": datasets.Value("float64"), |
|
|
"texture_mean": datasets.Value("float64"), |
|
|
"perimeter_mean": datasets.Value("float64"), |
|
|
"area_mean": datasets.Value("float64"), |
|
|
"smoothness_mean": datasets.Value("float64"), |
|
|
"compactness_mean": datasets.Value("float64"), |
|
|
"concavity_mean": datasets.Value("float64"), |
|
|
"concave points_mean": datasets.Value("float64"), |
|
|
"symmetry_mean": datasets.Value("float64"), |
|
|
"fractal_dimension_mean": datasets.Value("float64"), |
|
|
"radius_se": datasets.Value("float64"), |
|
|
"texture_se": datasets.Value("float64"), |
|
|
"perimeter_se": datasets.Value("float64"), |
|
|
"area_se": datasets.Value("float64"), |
|
|
"smoothness_se": datasets.Value("float64"), |
|
|
"compactness_se": datasets.Value("float64"), |
|
|
"concavity_se": datasets.Value("float64"), |
|
|
"concave points_se": datasets.Value("float64"), |
|
|
"symmetry_se": datasets.Value("float64"), |
|
|
"fractal_dimension_se": datasets.Value("float64"), |
|
|
"radius_worst": datasets.Value("float64"), |
|
|
"texture_worst": datasets.Value("float64"), |
|
|
"perimeter_worst": datasets.Value("float64"), |
|
|
"area_worst": datasets.Value("float64"), |
|
|
"smoothness_worst": datasets.Value("float64"), |
|
|
"compactness_worst": datasets.Value("float64"), |
|
|
"concavity_worst": datasets.Value("float64"), |
|
|
"concave points_worst": datasets.Value("float64"), |
|
|
"symmetry_worst": datasets.Value("float64"), |
|
|
"fractal_dimension_worst": datasets.Value("float64"), |
|
|
}) |
|
|
|
|
|
return datasets.DatasetInfo( |
|
|
description=_DESCRIPTION, |
|
|
features=features, |
|
|
homepage=_HOMEPAGE, |
|
|
license=_LICENSE, |
|
|
citation=_CITATION, |
|
|
) |
|
|
|
|
|
def _split_generators(self, dl_manager): |
|
|
urls = _URLS[self.config.name] |
|
|
data_file = dl_manager.download_and_extract(urls) |
|
|
|
|
|
return [ |
|
|
datasets.SplitGenerator( |
|
|
name=datasets.Split.TRAIN, |
|
|
gen_kwargs={ |
|
|
"filepath": data_file, |
|
|
"split": "train", |
|
|
}, |
|
|
), |
|
|
] |
|
|
|
|
|
def _generate_examples(self, filepath, split): |
|
|
with open(filepath, encoding="utf-8") as f: |
|
|
reader = csv.DictReader(f) |
|
|
for key, row in enumerate(reader): |
|
|
|
|
|
for field in row: |
|
|
if field != "diagnosis": |
|
|
try: |
|
|
row[field] = float(row[field]) |
|
|
except (ValueError, TypeError): |
|
|
row[field] = None |
|
|
|
|
|
yield key, row |
|
|
|