wisconsin-breast-cancer / load_script.py
Witold Wydmański
init
f927beb
import datasets
from datasets.tasks import TaskTemplate
from sklearn.model_selection import train_test_split
_ORIGIN = "https://archive-beta.ics.uci.edu/dataset/17/breast+cancer+wisconsin+diagnostic"
_CITATION = """\
Wolberg,William, Street,W. & Mangasarian,Olvi. (1995). Breast Cancer Wisconsin (Diagnostic). UCI Machine Learning Repository. https://doi.org/10.24432/C5DW2B.
"""
_DESCRIPTION = """\
Features are computed from a digitized image of a fine needle aspirate (FNA) of a breast mass. They describe characteristics of the cell nuclei present in the image. A few of the images can be found at http://www.cs.wisc.edu/~street/images/
"""
class WisconsinBreastCancer(datasets.GeneratorBasedBuilder):
def _info(self) -> datasets.DatasetInfo:
return datasets.DatasetInfo(
description=_DESCRIPTION,
citation=_CITATION,
homepage=_ORIGIN,
license="",
)
def _split_generators(self, dl_manager):
return [
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": "train.csv"}),
datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={"filepath": "test.csv"}),
]
def _generate_examples(self, filepath):
with open(filepath, "r") as f:
next(f)
for key, row in enumerate(f):
yield key, {"data": row[:-1], "label": row[-1]}