Skip to content

get_train_n_test_data

airt.keras.experiments.get_train_n_test_data(dataset_name: str, *, data_path: Optional[Union[Path, str]] = './data') -> Tuple[pd.DataFrame, pd.DataFrame] ยค

Download data

Parameters:

Name Type Description Default
dataset_name str

name of the dataset, one of "auto", "heart", compas", "blog", "loan"

required
data_path Optional[Union[Path, str]]

root directory where to download data to

'./data'
Source code in airt/keras/experiments.py
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
def get_train_n_test_data(
    dataset_name: str,
    *,
    data_path: Optional[Union[Path, str]] = "./data",
) -> Tuple[pd.DataFrame, pd.DataFrame]:
    """Download data

    Args:
        dataset_name: name of the dataset, one of "auto", "heart", compas", "blog", "loan"
        data_path: root directory where to download data to
    """
    data_path = _get_data_path(data_path)
    _download_data(dataset_name=dataset_name, data_path=data_path)

    dfx = [
        pd.read_csv(data_path / f"{prefix}_{dataset_name}.csv")
        for prefix in ["train", "test"]
    ]
    dfx = [_sanitize_col_names(df) for df in dfx]
    return dfx[0], dfx[1]