shap.datasets.communitiesandcrime

shap.datasets.communitiesandcrime(n_points=None)

Predict the total number of non-violent crimes per 100K population.

This dataset is from the classic UCI Machine Learning repository: https://archive.ics.uci.edu/ml/datasets/Communities+and+Crime+Unnormalized

Parameters:
n_pointsint, optional

Number of data points to sample. If provided, randomly samples the specified number of points.

Returns:
Tuple of pandas DataFrame containing the predictive features and a numpy array representing the target.

Examples

To get the processed data and target labels:

data, target = shap.datasets.communitiesandcrime()