Heterogeneous clustering and cross-modal evaluation metrics for crime prediction
This tool implements a crime prediction algorithm in a geological space using heterogeneous clustering and an evaluation metric. The algorithm and the metric is proposed by the Data Science Lab at USC (http://dslab.usc.edu/).
pip install -r packages.txt
to install all the packages.Edit config.py for parameter settings:
ignoreFirst
- int: Minimum amount of training periods
periodsAhead_list
- List of ints: Periods ahead to forecast
ug_gridshapes
- List of tuples: # of cells along latitude & longitude (for uniform grid method)
ug_maxDist
- Leave at 0 (for uniform grid method)
ug_threshold
- Leave at 0 (for uniform grid method)
ug_methods
- List of str: Any of [“mm”, “ar”, “harmonic]. Forecasting algorithms to use (for uniform grid method)
c_gridshape
- Tuple: # of cells along latitude & longitude (for cluster method)
c_thresholds
- int: Threshold of clustering (for cluster method)
c_maxDist
- int: Neighborhood distance of clustering (for cluster method)
c_methods
- List of str: Any of [“mm”, “ar”, “harmonic]. Forecasting algorithms to use (for cluster method)
resource_indexes
- List of int: List of amount of resources to use for evaluation (RA calculation)
cell_coverage_units
- int: Number of resources needed to cover each cell (RA calculation)
Sample usage for forecasting & evaluation (using LAdata.pkl
):
python parse_data.py DPSdata.pkl DPSUSC.pkl
python make_predictions.py LAdata.pkl
python calculate_resource_allocation.py
python plot_allocations.py
`