Skip to main content

DREDGE

User-friendly thresholded subspace-constrained mean shift for geospatial data

DREDGE, short for Density Ridge Estimation Describing Geospatial Evidence, arguably an unnecessarily forced acronym, offers a new tool to find density ridges in latitude-longitude coordinates based on the subspace-constrained mean shift (SCMS) algorithm introduced by Ozertem and Erdogmus (2011). The tool approximates principal curves for a given set of coordinates, featuring various improvements over the initial algorithm and alterations to facilitate the application to geospatial data: Thresholding, as described in cosmological research by Chen et al. (2015) and Chen et al. (2015), avoids dominant density ridges in sparsely populated areas of the dataset. In addition, the haversine formula is used as a distance metric to calculate the great circle distance, which makes the tool applicable not only to city-scale data, but also to datasets spanning multiple countries by taking the Earth's curvature into consideration.

In essence, DREDGE provides density-based line points which optimize the distance to a dataset of coordinates along those lines, with larger bandwidths leading to a decrease in summed line length and an increase in the average distance to the nearest line. Since DREDGE was initially developed to be applied to crime incident data, the default bandwidth calculation follows a best-practice approach that is well-accepted within quantitative criminology, using the mean distance to a given number of nearest neighbors (Williamson et al., 1999). Since practitioners in that area of study are often interested in the highest-density regions of a dataset, the tool also features the possibility to specify a top-percentage level for a kernel density estimate that the ridge points should fall within.

Installation

DREDGE can be installed via PyPI, with a single command in the terminal:

pip install dredge

Alternatively, the file dredge.py can be downloaded from the folder dredge in this repository and used locally by placing the file into the working directory for a given project. An installation via the terminal is, however, highly recommended, as the installation process will check for the package requirements and automatically update or install any missing dependencies, thus sparing the user the effort of troubleshooting and installing them themselves.

Quickstart guide

DREDGE only requires a two-column NumPy array as its primary input (coordinates), with one data point per row, and latitude and longitude values in the columns. Four additional optional parameters can, however, be set: The number of nearest neighbors (neighbors) used to automatically calculate an optimal bandwidth can be manually changed, the bandwidth (bandwidth) itself can be forced to a certain value, and the threshold used to check for convergence between iterations can be set (threshold). The fourth parameter (percentage) unlocks an additional functionality of DREDGE, as the interest of practitioners is often constrained to high-density areas. For a user-provided percentage value p, the kernel density estimation in the tool's inner workings is used to only retain ridge points above the (100 - p)th percentile of the provided dataset's density landscape. This allows, for example, route matching to be focused on these areas.



Variables Explanations Default
coordinates The spatial data as latitude-longitude coordinates
neighbors (optional) The number of nearest neighbors to get a bandwidth 10
bandwidth (optional) The bandwidth used for kernel density estimates None
convergence (optional) The threshold used for inter-iteration convergence 0.01
percentage (optional) The aimed-for percentage of highest-density ridges None



After the installation via PyPI, or using the dredge.py file locally, the usage looks like this:

from dredge import filaments

filaments(coordinates = your_coordinates,
                        percentage = 5) 

Metadata

Release files for dredge 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dredge 1.0.0
File Size Uploaded Provenance
dredge-1.0.0.tar.gz 9.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for dredge 1.0.0
File Interpreter ABI Platform
dredge-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 20.9 kB

Release files / dredge-1.0.0.tar.gz

Download URL dredge-1.0.0.tar.gz
Size 9.6 kB
Tags Source
SHA-256 checksum
How to use checksums
d1dc9c199b681f81915730fa47bef78b8ab519781bbc109c19e94848ebe2c620
BLAKE2b-256 checksum
How to use checksums
1513d5b2d000961ca09498dca5a58aebeb735c324de2c25c6ace9240754a449b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.6

Release files / dredge-1.0.0-py3-none-any.whl

Download URL dredge-1.0.0-py3-none-any.whl
Size 11.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6d421dcb255fea0ba08b9e0a549bbe0d021fbb0d85cc5cc140b0c0249bb28c28
BLAKE2b-256 checksum
How to use checksums
a022c12a68cecd1a88b2bef3d75b9f343699841f0be71c7cbe0d0c1ead80c205
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.6

Security for dredge 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page