load_loans

getml.datasets.load_loans(roles=True, units=True, as_pandas=False, as_dict=False)[source]

Binary classification dataset on loan default

The loans dataset is based on financial dataset from the the CTU Prague Relational Learning Repository.

The original publication is: Berka, Petr (1999). Workshop notes on Discovery Challange PKDD’99.

The dataset contains information on 606 successful and 76 unsuccessful loans. After some preprocessing it contains 5 tables

  • account: Information about the borrower(s) of a given loan.

  • loan: Information about the loans themselves, such as the date of creation, the amount, and the planned duration of the loan. The target variable is the status of the loan (default/no default)

  • meta: Meta information about the obligor, such as gender and geo-information

  • order: Information about permanent orders, debited payments and account balances.

  • trans: Information about transactions and accounts balances.

The population table is split into a training and a testing set at 80% of the main population.

Args:
roles (bool):

Return data with roles set

units (bool):

Return data with units set

as_pandas (bool):

Return data as pandas.DataFrame s

as_dict (bool):

Return data as dict with df.name s as keys and df s as values.

Returns:
tuple:

Tuple containing (sorted alphabetically by df.name`s) the data as :class:`~getml.DataFrame s or pandas.DataFrame s (if as_pandas is True) or

dict:

if as_dict is True: Dictionary containing the data as DataFrame s or pandas.DataFrame s (if as_pandas is True). The keys correspond to the name of the DataFrame on the engine.

The following DataFrames are returned:

  • account

  • loan

  • meta

  • order

  • trans

Examples:
>>> loans = getml.datasets.load_loans(as_dict=True)
>>> type(loans["population_train"])
... getml.data.data_frame.DataFrame

For an full analysis of the loans dataset including all necessary preprocessing steps please refer to getml-examples.

Note:

Roles and units can be set ad-hoc by supplying the respective flags. If roles is False, all columns in the returned DataFrames s have roles unused_string or unused_float. Before using them in an analysis, a data model needs to be constructed using Placeholder s.