Datasets¶
datasets
¶
Benchmark dataset loaders with local caching and license notes.
Each loader returns (X, y): X a DataFrame whose categorical features are pd.Categorical dtype, y a Series (binary targets are int 0/1 with the "event"/positive class = 1). Data is fetched at runtime and cached under data_dir(); raw files are never committed to the repository. Verify each dataset's license on its source page before redistributing anything.
data_dir
¶
Cache directory: $FLAGGAM_DATA_DIR or ~/.cache/flaggam (created).
load_breast_cancer
¶
Wisconsin Diagnostic Breast Cancer (569 x 30, binary; positive=malignant).
Source: https://archive.ics.uci.edu/dataset/17 (bundled via scikit-learn). License: CC BY 4.0 per UCI page — verify before redistribution.
Source code in src/flaggam/datasets.py
load_california
¶
California Housing (20640 x 8, regression on median house value).
Source: https://scikit-learn.org/stable/datasets/real_world.html#california-housing-dataset License: public domain (US Census derived) — verify before redistribution.
Source code in src/flaggam/datasets.py
load_pima
¶
Pima Indians Diabetes (768 x 8, binary; positive=diabetic).
Source: https://www.openml.org/d/37 (Pima Indians Diabetes, dataset id=37). License: CC0 per OpenML page — verify before redistribution. Observed variant: OpenML dataset 37 (pima_diabetes), 768 rows, 8 features. Short attribute names renamed: plas→glucose, pres→blood_pressure, skin→skin_thickness, insu→insulin, mass→bmi, pedi→diabetes_pedigree.
DECISIONS 17: Physiologically impossible zeros (glucose, blood_pressure, skin_thickness, insulin, bmi) are replaced with NaN per clinical convention and FlagGAM's native-missing design.
Source code in src/flaggam/datasets.py
load_heart
¶
Heart Disease Cleveland (303 x 13, binary; positive=disease present).
Source: https://archive.ics.uci.edu/dataset/45 (Heart Disease, Cleveland). License: CC BY 4.0 — verify before redistribution. Target: num > 0 → 1. Observed variant: UCI id=45, Cleveland 303 rows, 13 features (all numeric). ca/thal have missing values (kept as NaN). Categorical features (originally coded as integers): cp, restecg, slope, thal, sex, fbs, exang.
Source code in src/flaggam/datasets.py
load_german_credit
¶
Statlog German Credit (1000 x 20, binary; positive=bad credit).
Source: https://archive.ics.uci.edu/dataset/144 (Statlog German Credit). License: CC BY 4.0 — verify before redistribution. Target: bad credit = 1. Observed variant: UCI id=144, 1000 rows, 20 features (Attribute* columns). Target: class==2 → bad credit=1 (per UCI docs, 1=good, 2=bad).
Source code in src/flaggam/datasets.py
load_adult
¶
Adult / Census Income (~48842 rows, binary; positive=income >50K).
Source: https://archive.ics.uci.edu/dataset/2 (Adult / Census Income). License: CC BY 4.0 — verify before redistribution. Target: income >50K = 1. Observed variant: UCI id=2, 48842 rows, 14 features. Whitespace stripped; '?' replaced with NaN; string cols → pd.Categorical.
Source code in src/flaggam/datasets.py
load_bank_marketing
¶
Bank Marketing — bank-additional-full variant (41188 rows, binary; positive=subscribed).
Source: https://www.openml.org/d/42813 (OpenML id=42813, bank-additional-full variant). License: CC BY 4.0 — verify before redistribution. Observed variant: bank-additional-full (spec §9), 41188 rows, 21 original features including socioeconomic columns emp.var.rate, cons.price.idx, cons.conf.idx, euribor3m, nr.employed. After dropping 'duration' → 19 feature columns + y. The post-call 'duration' column is always dropped (UCI recommendation, spec §9). 'unknown' is kept as a regular category level (FlagGAM/UFA design: treat as explicit category, not NaN, to preserve structure of missingness).
Source code in src/flaggam/datasets.py
load_ames
¶
Ames Housing (2930 rows, regression; target = log(Sale_Price)).
Source: https://www.openml.org/search?type=data&q=ames+housing (Ames Housing). License: public domain (De Cock, 2011) — verify before redistribution. Observed variant: OpenML 'ames_housing' version 1 (id=43926), 2930 rows, 80 features. OpenML returns features already as ordered CategoricalDtype. Target is log(Sale_Price); RMSE is reported on the log scale.
Source code in src/flaggam/datasets.py
load_wine_white
¶
Wine Quality white subset (4898 x 11, regression on quality score).
Source: https://archive.ics.uci.edu/dataset/186 (Wine Quality, white subset). License: CC BY 4.0 — verify before redistribution. Observed variant: UCI id=186 (combined red+white, 6497 rows); 'color' column found in ds.data.original — filtered to white wines → 4898 rows, 11 features. All features are float; no categorical columns.