Example datasets

gshap.datasets.load_recidivism

def gshap.datasets.load_recidivism(return_X_y=False) [source]

Load the COMPAS recidivism dataset. The purpose of this dataset is to predict whether a criminal will recidivate within two years of release.

Parameters: return_X_y : bool, default=False

Indicates whether to return just the X and y matrices, as opposed to the data Bunch.

Returns: bunch : Bunch

Object containing the dataframe, X feature matrix, and y target vector. Or, if return_X_y, return (X,y).

gshap.datasets.load_gdp

def gshap.datasets.load_gdp(return_X_y=False) [source]

Load the GDP growth dataset (from FRED data). The purpose of this dataset is to forecast GDP growth based on macroeconomic variables.

Parameters: return_X_y : bool, default=False

Indicates whether to return just the X and y matrices, as opposed to the data Bunch.

Returns: bunch : Bunch

Object containing the dataframe, X feature matrix, and y target vector. Or, if return_X_y, return (X,y).

gshap.datasets.Bunch

class gshap.datasets.Bunch(filename, target) [source]

Dataset container.

Parameters: filename : str

Name of the file in gshap/datasets.

target : str

Name of target variable

Attributes: df : pandas.DataFrame

Dataframe containing features and the target variable.

data : pandas.DataFrame

Dataframe containing only the features

target : pandas.Series

Series of the target variable.