compileml.datasets

load_credit_default

def load_credit_default(*, include_demographics: bool = False, cache_dir: str | os.PathLike | None = None, download: bool = True) -> tuple[numpy.ndarray, numpy.ndarray, list[str]]

from compileml.datasets import load_credit_default

Load the UCI credit-card default panel.

Parameters#

NameTypeDefaultKind
include_demographicsInclude SEX, EDUCATION, MARRIAGE and AGE. Excluded by default; see the module docstring for why.boolFalsekeyword-only
cache_dirWhere to keep the downloaded file. Defaults to $COMPILEML_DATA_HOME or ~/.compileml/data.str | os.PathLike | NoneNonekeyword-only
downloadWhen False, raise instead of reaching the network if the cache is cold.boolTruekeyword-only

Returns#

tuple[numpy.ndarray, numpy.ndarray, list[str]]

(X, y, feature_names) — X float64 of shape (30000, 19), or (30000, 23) with demographics; y int of shape (30000,) with a 22.12% base rate; feature_names in column order.

Raises#

  • FileNotFoundError
  • OSError

Read from the function body and the private helpers it calls, not inferred. A function that raises nothing has no section here.

Notes#

Every value in the source is an integer, including the currency amounts (New Taiwan dollars, unrounded). X is returned as float64 because that is what the compile side expects, but no precision is lost in the conversion, and the split comparisons the artifact performs are exact.