Skip to content

Commit

Permalink
v0.2.6
Browse files Browse the repository at this point in the history
  • Loading branch information
yan-yuchen committed Apr 18, 2024
1 parent dd693e9 commit dd21ae9
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 78 deletions.
9 changes: 4 additions & 5 deletions GeoHD.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: GeoHD
Version: 0.2.5
Version: 0.2.6
Summary: A Python toolkit for geospatial hotspot detection, Avisualization, and analysis using urban data
Home-page: https://github.com/yan-yuchen/GeoHD
Author: Yuchen Yan
Expand All @@ -18,8 +18,8 @@ Requires-Dist: h3
# GeoHD

![python](https://img.shields.io/badge/python-3.11-black)
![GitHub release](https://img.shields.io/badge/release-v0.2.5-blue)
![pypi](https://img.shields.io/badge/pypi-v0.2.5-orange)
![GitHub release](https://img.shields.io/badge/release-v0.2.6-blue)
![pypi](https://img.shields.io/badge/pypi-v0.2.6-orange)
![license](https://img.shields.io/badge/license-GNU%20AGPLv3-green)

[**Getting Started**](#getting-started)
Expand Down Expand Up @@ -153,5 +153,4 @@ The authors of the GeoHD package welcome external contributions to the source co
## Authors

* Yuchen Yan
* Yuxin Wang
* Wei Quan

7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# GeoHD

![python](https://img.shields.io/badge/python-3.11-black)
![GitHub release](https://img.shields.io/badge/release-v0.2.5-blue)
![pypi](https://img.shields.io/badge/pypi-v0.2.5-orange)
![GitHub release](https://img.shields.io/badge/release-v0.2.6-blue)
![pypi](https://img.shields.io/badge/pypi-v0.2.6-orange)
![license](https://img.shields.io/badge/license-GNU%20AGPLv3-green)

[**Getting Started**](#getting-started)
Expand Down Expand Up @@ -136,5 +136,4 @@ The authors of the GeoHD package welcome external contributions to the source co
## Authors

* Yuchen Yan
* Yuxin Wang
* Wei Quan

Binary file removed dist/GeoHD-0.2.5.tar.gz
Binary file not shown.
Binary file not shown.
Binary file added dist/geohd-0.2.6.tar.gz
Binary file not shown.
6 changes: 5 additions & 1 deletion doc/source/changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Changelog

## Version 0.2.5 (April 13, 2014)
## Version 0.2.6 (April 19, 2024)

Updated documentation.

## Version 0.2.5 (April 13, 2024)

Improved documentation and made minor adjustments to some function comments.

Expand Down
7 changes: 3 additions & 4 deletions doc/source/index.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# GeoHD

![python](https://img.shields.io/badge/python-3.11-black)
![GitHub release](https://img.shields.io/badge/release-v0.2.5-blue)
![pypi](https://img.shields.io/badge/pypi-v0.2.5-orange)
![GitHub release](https://img.shields.io/badge/release-v0.2.6-blue)
![pypi](https://img.shields.io/badge/pypi-v0.2.6-orange)
![license](https://img.shields.io/badge/license-GNU%20AGPLv3-green)


Expand Down Expand Up @@ -43,8 +43,7 @@ The authors of the GeoHD package welcome external contributions to the source co
## Authors

* Yuchen Yan
* Yuxin Wang
* Wei Quan


```{toctree}
---
Expand Down
63 changes: 0 additions & 63 deletions doc/source/theory.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,67 +15,4 @@ Existing studies often remain confined to singular research contexts, lacking co

GeoHD is a Python toolbox designed for the detection, visualization, and analysis of geographical spatial hotspots. Its primary objective is to provide a user-friendly tool applicable across various urban research backgrounds for hotspot detection and analysis.

### Adaptive Kernel Density Estimation

The Adaptive Kernel Density Estimation (AKDE) is a technique tailored to adjust the bandwidth of Kernel Density Estimation (KDE) in accordance with the spatial arrangement of disparate datasets. This research refines the AKDE for pinpointing hotspots within urban confines through a trio of sequential stages: preliminary assessment, local bandwidth specification, and computation of kernel density.

#### Step 1: Initial Assessment

The initial assessment phase entails creating an initial approximation of the distribution of the event under study, denoted as $S$, by employing kernel density estimation with an assigned bandwidth. A Gaussian function is utilized as the core function for this preliminary approximation. Given a dataset comprising $N$ points within the research area, with each event $s_i$ located at coordinates $\langle x_i, y_i \rangle$, the initial estimate of the density $f_{\tilde{HS}}(s)$ is derived as follows:

$$f_{\tilde{HS}}(s) = \frac{1}{N} \sum_{i=1}^{N} K_{H}(s - s_i) \tag{1}$$

The core function $K_{H}(s - s_i)$ is a Gaussian with bandwidth $H$:

$$K_{H}(s - s_i) = \frac{1}{2\pi H_1 H_2} \exp\left(-\frac{(x - x_i)^2}{2H_1^2} - \frac{(y - y_i)^2}{2H_2^2}\right) \tag{2}$$

The bandwidth $H$ is composed of the longitudinal bandwidth $H_1$ and the latitudinal bandwidth $H_2$:

$$H_1 = 1.06N^{-1/5} \sqrt{\frac{1}{N} \sum_{i=1}^{N} (x_i - \frac{1}{N} \sum_{j=1}^{N} x_j)^2} \tag{3}$$

$$H_2 = 1.06N^{-1/5} \sqrt{\frac{1}{N} \sum_{i=1}^{N} (y_i - \frac{1}{N} \sum_{j=1}^{N} y_j)^2} \tag{4}$$

#### Step 2: Specification of Local Bandwidth

Utilizing the outcomes from the initial assessment, the local bandwidth at $s_i$, denoted as $h_i$, is ascertained:

$$h_i = \left(\left(g^{-1} f_{\tilde{HS}}(s_i)\right)^{-\alpha}\right) \tag{5}$$

The parameter $\alpha$ is a sensitivity factor that ranges from 0 to 1, inclusive. A higher value of $\alpha$ results in more pronounced variations in local bandwidths. The geometric mean $g$ is defined as:

$$g = \sqrt{n \prod_{i=1}^{n} f_{\tilde{HS}}(s_i)} \tag{6}$$

#### Step 3: Computation of Kernel Density

The AKDE is ultimately computed using the local bandwidths:

$$f_{HS}(s) = \frac{1}{N} \sum_{i=1}^{N} K_{H_{h_i}}(s - s_i) \tag{7}$$

$$K_{H_{h_i}}(s - s_i) = \frac{1}{2\pi H_1 H_2 h_i^2} \exp\left(-\frac{(x - x_i)^2}{2H_1^2 h_i^2} - \frac{(y - y_i)^2}{2H_2^2 h_i^2}\right) \tag{8}$$

In areas characterized by a dense concentration of events, the larger initial estimate from Eq. (1) used in Eq. (5) will lead to a reduced local bandwidth. In contrast, areas with a sparser distribution of events will yield an expanded local bandwidth.

Incorporating AKDE in this investigation facilitates the circumvention of estimation biases associated with a fixed bandwidth and enhances the precision of spatial distribution variations in event occurrences.

### Hotspot Recognition

The process of identifying local hotspots of events within a study area involves a series of computational steps. Initially, we examine the dataset `S` consisting of events that have occurred within the area of interest, represented as `S = {s_1, s_2, ..., s_N}`. Following an adaptive kernel density analysis, we generate a raster dataset that depicts the density field. We then proceed with further manipulations of this raster data. Utilizing a window analysis technique, we compute a pixel maximum value surface from the raster data. Subsequently, we engage in a map algebraic operation, subtracting the pixel maximum value surface from the density field surface to create a subtracted surface, which is a non-negative value surface. Locations with zero values in the subtracted surface indicate the positions of local hotspots in the current area. After the window analysis, we employ a reclassification technique to segregate the extreme value regions from the non-extreme value areas into two distinct classes. The extreme value regions, identified through this method, correspond to the hotspots of events in the current area, denoted as `HS = {hs_1, hs_2, ..., hs_K}`. The specific steps of this methodology are as follows:

#### Step 1: Data Input
Introduce the dataset `S`, which contains events from the study area, into the computational system.

#### Step 2: Adaptive Kernel Density Analysis
Subject the dataset `S` to an adaptive kernel density analysis to produce a raster dataset representing the density field. This dataset mirrors the spatial arrangement of events within the study area.

#### Step 3: Window Analysis Method
Implement the window analysis method to calculate the pixel maximum value surface from the raster data. This step yields the highest density value within each defined window.

#### Step 4: Map Algebra Subtraction Operation
Execute a map algebraic subtraction between the density field surface and the pixel maximum value surface to generate a subtracted surface. Locations within each window that exhibit zero values are indicative of local hotspots in the current area.

#### Step 5: Reclassification Algorithm
Apply a reclassification algorithm to divide the subtracted surface into two categories: regions with extreme values and regions without extreme values.

#### Step 6: Hotspot Extraction
Isolate the regions with extreme values from the reclassified dataset to extract the set of hotspots `HS`, which correspond to areas of event occurrence within the current area.

2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(
name='GeoHD',
version='0.2.5',
version='0.2.6',
description='A Python toolkit for geospatial hotspot detection, Avisualization, and analysis using urban data',
author='Yuchen Yan',
author_email='[email protected]',
Expand Down

0 comments on commit dd21ae9

Please sign in to comment.