HyperAI

Gnnwr Spatiotemporal Intelligent Regression (STIR) Model Demo

PyPI - License

This tutorial is a PyTorch implementation of the Spatio-Temporal Intelligent Regression (STIR) model. The computing resources used are RTX 4090. The "workspace" contains the following notebook automation script demonstration examples:

  • GNNWR: Demonstration example is "PM2.5 air pollution"

English version:demo_gnnwr.ipynb

Chinese version:demo_gnnwr-cn.ipynb

  • GTNNWR: Demonstration example: "Spatial and temporal distribution of key nutrients in coastal waters"

English version:demo_gnnwr.ipynb

Chinese version:demo_gnnwr-cn.ipynb

Additionally, this repository contains:

  1. Source code for GNNWR, GTNNWR and other derivative models
  2. Tutorial notes for the model (notebook automation scripts)
  3. Released Python Wheels

Table of contents

1. Introduction

GNNWR (Geographically Neural Network Weighted Regression) is a PyTorch-based spatiotemporal intelligent regression model developed by the GIS Laboratory of Zhejiang University in 2020. It is specifically designed to deal with spatial and temporal non-stationarity problems. The model achieves high-precision modeling of complex geographic processes by converting the nonlinear fitting of geographic proximity and non-stationary weights into the representation and construction of neural networks.

Spatiotemporal non-stationarity is an inherent property of most geographic processes, and its estimation is a key issue in modeling spatiotemporal non-stationary relationships. In order to characterize spatiotemporal non-stationary relationships, the research team transformed the expression of geographic proximity and the nonlinear fitting of non-stationary weights into the representation and construction of neural networks, and established a series of spatiotemporal intelligent regression (STIR) models, including geographic neural network weighted regression (GNNWR) and geographic time neural network weighted regression (GTNNWR).

The model performance is significantly better than classical spatiotemporal regression methods, such as geographically weighted regression (GWR) and geographical time weighted regression (GTWR), as well as machine learning methods such as neural networks and random forests. The STIR model has been applied to ecological environment modeling, atmospheric pollutant estimation, urban housing price research and other fields. Related research results have been published in journals such as "International Journal of Geographic Information Science", "Environmental Science and Technology", "Environmental Pollution", "Integrated Environmental Science", and "International Journal of Applied Earth Observation and Geographic Information".

2. Model

2.1 GNNWR

GNWR(Geo-neural network weighted regression) is a model for dealing with spatial non-stationarity in various complex geographic process fields. This paper proposes a spatially weighted neural network (SWNN) to represent the non-stationary weight matrix and locally estimate these weights by weighted least squares. GNNWR has a well-structured non-stationary weight matrix with its excellent fitting ability, thus better describing complex geographic processes in environmental and urban studies.

GNWR

Du, Z., Wang, Z., Wu, S., Zhang, F., & Liu, R. (2020). Geographically neural network weighted regression for the accurate estimation of spatial non-stationarity. International Journal of Geographical Information Science, 34(7), 1353-1377.

Demonstration Example - PM2.5 Air Pollution

English version:demo_gnnwr.ipynb

Chinese version:demo_gnnwr-cn.ipynb

2.2 GTNNWR

GTNNWR(Geographic and Temporal Neural Network Weighted Regression) is a model for estimating spatiotemporal non-stationary relationships. Due to the existence of spatiotemporal non-stationarity, the spatial relationship of elements shows obvious differences as the spatiotemporal structure changes. The calculation of spatiotemporal distance is an important aspect of solving the problem of spatiotemporal non-stationarity. Therefore, this model introduces spatiotemporal distance into the GNNWR model, and proposes a spatiotemporal neighbor neural network (STPNN) to accurately calculate the spatiotemporal distance, and cooperates with the SWNN in the GNNWR model to calculate the spatiotemporal non-stationary weight matrix, thereby achieving accurate modeling of spatiotemporal non-stationary relationships.

GTNNWR

Wu, S., Wang, Z., Du, Z., Huang, B., Zhang, F., & Liu, R. (2021). Geographically and temporally neural network weighted regression for modeling spatiotemporal non-stationary relationships. International Journal of Geographical Information Science , 35(3), 582-608.

Demonstration example - Spatiotemporal distribution of key nutrients in coastal waters

English version:demo_gnnwr.ipynb

Chinese version:demo_gnnwr-cn.ipynb

3. Other research cases

3.1 Atmospheric environment

3.1.1 PM2.5 air pollution

Air pollution, especially PM2.5 measurement, has become a hot research topic in China in recent years. Due to China's complex terrain and wide geographical range, using scattered PM2.5 observation station data to estimate and map the PM2.5 concentration distribution in China faces significant spatial non-stationarity and complex nonlinear problems, making it difficult to achieve high-precision and high-precision distribution estimates. The GNNWR model can combine aerosol optical depth (AOD), digital elevation model (DEM) and some climate factors to obtain spatially continuous PM2.5 concentration estimates in China. Compared with the results of traditional regression models, the PM2.5 estimation results of the GNNWR model are closer to ground observations, with higher accuracy and richer details in high-value areas.

PM25

Chen, Y., Wu, S., Wang, Y., Zhang, F., Liu, R., & Du, Z. (2021). Satellite-based mapping of high-resolution ground-level pm2. 5 with VIIRS IP AOD in China through spatially neural network weighted regression. Remote Sensing13(10), 1979.

👉 Modeling PM2.5 with GNNWR on Deep-time.org

3.1.2 NO2 air pollution

This study used TROPOMI remote sensing data, ground observation data and other auxiliary data to construct and evaluate the high-resolution spatiotemporal distribution characteristics of ground NO2 concentration in the Beijing-Tianjin-Hebei region based on the GTNNWR model. The results show that the GTNNWR model is superior to the random forest (RF) and convolutional neural network (CNN) models in terms of performance indicators, and shows higher reliability when considering spatiotemporal non-stationarity. This study provides important data support and reference for atmospheric environmental management and pollution prevention in the Beijing-Tianjin-Hebei region.

NO2

Liu, C., Wu, S., Dai, Z., Wang, Y., Du, Z., Liu, X., & Qiu, C. (2023). High-Resolution Daily Spatiotemporal Distribution and Evaluation of Ground-Level Nitrogen Dioxide Concentration in the Beijing–Tianjin–Hebei Region Based on TROPOMI Data. Remote Sensing15(15), 3878.

3.2 Coastal Zone and Marine Environment

3.2.1 Water quality

Accurate assessment of large-scale and complex coastal waters is a huge challenge due to the spatial non-stationarity and complex nonlinearity involved in the integration of remote sensing and field data. To address this challenge, we developed a water quality assessment method based on the newly proposed GNNWR model and obtained a high-precision and realistic water quality distribution based on the comprehensive index of the Chinese Water Quality Classification Standard. Compared with widely used models, the GNNWR model has higher prediction performance (average R² = 84%), and the obtained water quality classification (WQC) maps for May 2015-2017 and August 2015 can intuitively and reasonably depict the spatiotemporal pattern of water quality in the zero pollution zone.

Water Quality

Du, Z., Qi, J., Wu, S., Zhang, F., & Liu, R. (2021). A spatially weighted neural network based water quality assessment method for large-scale coastal areas. Environmental science & technology55(4), 2553-2563.

3.2.2 Coastal environment

The transport of dissolved silicates (DSi) from land to coastal environments is critical for global biogeochemical cycles. However, pinpointing the distribution of DSi in coastal zones is complex due to spatiotemporal variability, nonlinear modeling, and low sampling resolution. The GTNNWR model outperforms traditional regression models in both fitting accuracy and generalization ability by converting the spatiotemporal relationships between sparsely sampled points and unknown points into spatiotemporal distances and weights, and using neural networks to determine nonlinear distances and nonstationary weights. This effective data-driven approach helps explore fine-scale dynamic changes in coastal waters, such as surface DSi.

DSI

Qi, J., Du, Z., Wu, S., Chen, Y., & Wang, Y. (2023). A spatiotemporally weighted intelligent method for exploring fine-scale distributions of surface dissolved silicate in coastal seas. Science of The Total Environment , 886, 163981.

👉 Modeling DSi with GTNNWR on Deep-time.org

3.2.3 Surface seawater pCO2

The North Pacific is an important carbon sink, but its spatiotemporal dynamics remain understudied due to its large size and complex impacts. Existing machine learning models lack interpretability, limiting insights into the underlying mechanisms. To address this issue, we introduce a gridded spatiotemporal neural network weighted regression (GSTNNWR) model that can accurately predict surface pCO2 while quantifying environmental impacts.

Liu, Y., Chen, Y., Huang, Z., Liang, H., Qi, J., Wu, S., & Du, Z. (2024). Spatiotemporal weighted neural network reveals surface seawater pCO2 distributions and underlying environmental mechanisms in the North Pacific Ocean. International Journal of Applied Earth Observation and Geoinformation, 133, 104120.

3.3 Cities

3.3.1 Housing Prices

Housing prices are closely related to the lives of new urban residents and are also important economic indicators that the government needs to pay close attention to. Compared with traditional regression models, GNNWR and GTNNWR models can improve the accuracy of real estate valuation with the help of neural networks, and are practical and effective methods for evaluating housing prices.

The GNNWR model integrates an optimized spatial proximity metric. The optimized spatial proximity metric combines multiple distance metrics and improves its ability to model spatial non-stationary processes.

OSP

Ding, J., Cen, W., Wu, S., Chen, Y., Qi, J., Huang, B., & Du, Z. (2024). A neural network model to optimize the measure of spatial proximity in geographically weighted regression approach: a case study on house price in Wuhan. International Journal of Geographical Information Science, 1–21.

By incorporating contextual similarity into spatial non-stationarity estimation using an attention-based architecture, housing prices can be better adapted to complex urban areas.

CatGWR

Wu, S., Ding, J., Wang, R., Wang, Y., Yin, Z., Huang, B., & Du, Z. (2025). Using an attention-based architecture to incorporate context similarity into spatial non-stationarity estimation. International Journal of Geographical Information Science, 1–24

HousePrice

Wang, Z., Wang, Y., Wu, S., & Du, Z. (2022). House Price Valuation Model Based on Geographically Neural Network Weighted Regression: The Case Study of Shenzhen, China. ISPRS International Journal of Geo-Information11(8), 450.

3.3.2 Surface temperature and night light

Spatial downscaling is an important method to obtain high-resolution land surface temperature (LST) data for thermal environment research. In order to effectively solve the problem of land surface temperature downscaling, this paper proposes a high-resolution land surface temperature downscaling method based on GNNWR. The results show that in four test areas with large differences in topography, landforms and seasons, the proposed GNNWR model achieves higher downscaling accuracy compared with widely used methods. Given the high accuracy and model performance of GNNWR, the results show that GNNWR is a practical land surface temperature downscaling method.

LST

Liang, M., Zhang, L., Wu, S., Zhu, Y., Dai, Z., Wang, Y., … & Du, Z. (2023). A High-Resolution Land Surface Temperature Downscaling Method Based on Geographically Weighted Neural Network Regression. Remote Sensing15(7), 1740.

Downscaling of nighttime lights (NTL) using satellite images is crucial for urban expansion and socioeconomic research, but it faces many challenges due to geographical complexity and factor uncertainty. To address this issue, we propose a multi-factor geographic neural network weighted regression (MF-GNNWR) framework that integrates land surface, socioeconomic, and human activity factors to improve the accuracy of nighttime lights (NTL) in heterogeneous urban areas.

Zhang, L., Wu, S., Liang, M., Jing, H., Shi, S., Zhu, Y., … & Du, Z. (2024). A Downscaling Framework for Urban Nighttime Light Based on Multi-Factor Geographically Neural Network Weighted Regression. IEEE Transactions on Geoscience and Remote Sensing.

3.4 Geology

3.4.1 Mineral Exploration Potential

In the field of mineral prediction, accurate prediction of mineral resources is essential to meet the energy needs of modern society. Geographic neural network weighted logistic regression is used for mineral exploration mapping. The model combines spatial patterns, neural networks and Shapley's additive interpretation theory to effectively handle the anisotropy of variables and nonlinear relationships between variables, thereby achieving accurate prediction and providing an explanation for mineralization in complex spatial environments.

mineral prospectivity

Wang, L., Yang, J., Wu, S., Hu, L., Ge, Y., & Du, Z. (2024). Enhancing mineral prospectivity mapping with geospatial artificial intelligence: A geographically neural network-weighted logistic regression approach. International Journal of Applied Earth Observation and Geoinformation, 128, 103746.

3.4.2 Heat flow

Surface heat flow (SHF) is essential for understanding the dynamics of the Earth's interior. The Qinghai-Tibet Plateau is a key region for global climate and geodynamic studies, but comprehensive SHF data are lacking due to sparse observational data. To address this issue, we developed an enhanced interpretability geographic neural network weighted regression model (EI-GNNWR) that integrates spatial heterogeneity and nonlinear geophysical interactions. Our model accurately predicts SHF across the plateau, revealing that high SHF values are concentrated in the south, northeast, and southeast, influenced by the depth of the Moho surface, ridges, and topography. These findings enhance the understanding of geothermal processes and tectonic activity in the region.

SHF

Zhang, Z., Wu, S., Zhang, B., Du, Z., & Xia, Q. (2024). The distribution of surface heat flow on the Tibetan Plateau revealed by data-driven methods. Journal of Geophysical Research: Solid Earth, 129(10), e2023JB028491.

!! In addition, these spatiotemporal intelligent regression models can be applied to other spatiotemporal modeling problems and socioeconomic phenomena.

4. Related research papers

4.1 Algorithm

  1. Du, Z., Wang, Z., Wu, S., Zhang, F., & Liu, R. (2020). Geographically neural network weighted regression for the accurate estimation of spatial non-stationarity. International Journal of Geographical Information Science, 34(7), 1353-1377.
  2. Wu, S., Wang, Z., Du, Z., Huang, B., Zhang, F., & Liu, R. (2021). Geographically and temporally neural network weighted regression for modeling spatiotemporal non-stationary relationships. International Journal of Geographical Information Science , 35(3), 582-608.
  3. Dai, Z., Wu, S., Wang, Y., Zhou, H., Zhang, F., Huang, B., & Du, Z. (2022). Geographically convolutional neural network weighted regression: A method for modeling spatially non-stationary relationships based on a global spatial proximity grid. International Journal of Geographical Information Science36(11), 2248-2269.

4.2 Case Study Demonstration

  1. Chen, Y., Wu, S., Wang, Y., Zhang, F., Liu, R., & Du, Z. (2021). Satellite-based mapping of high-resolution ground-level pm2. 5 with VIIRS IP AOD in China through spatially neural network weighted regression. Remote Sensing13(10), 1979.
  2. Qi, J., Du, Z., Wu, S., Chen, Y., & Wang, Y. (2023). A spatiotemporally weighted intelligent method for exploring fine-scale distributions of surface dissolved silicate in coastal seas. Science of The Total Environment , 886, 163981.
  3. Du, Z., Qi, J., Wu, S., Zhang, F., & Liu, R. (2021). A spatially weighted neural network based water quality assessment method for large-scale coastal areas. Environmental science & technology55(4), 2553-2563.
  4. Liang, M., Zhang, L., Wu, S., Zhu, Y., Dai, Z., Wang, Y., … & Du, Z. (2023). A High-Resolution Land Surface Temperature Downscaling Method Based on Geographically Weighted Neural Network Regression. Remote Sensing15(7), 1740.
  5. Liu, C., Wu, S., Dai, Z., Wang, Y., Du, Z., Liu, X., & Qiu, C. (2023). High-Resolution Daily Spatiotemporal Distribution and Evaluation of Ground-Level Nitrogen Dioxide Concentration in the Beijing–Tianjin–Hebei Region Based on TROPOMI Data. Remote Sensing15(15), 3878.
  6. Wang, Z., Wang, Y., Wu, S., & Du, Z. (2022). House Price Valuation Model Based on Geographically Neural Network Weighted Regression: The Case Study of Shenzhen, China. ISPRS International Journal of Geo-Information11(8), 450.
  7. Wu, S., Du, Z., Wang, Y., Lin, T., Zhang, F., & Liu, R. (2020). Modeling spatially anisotropic nonstationary processes in coastal environments based on a directional geographically neural network weighted regression. Science of the Total Environment709, 136097.
  8. Wang, L., Yang, J., Wu, S., Hu, L., Ge, Y., & Du, Z. (2024). Enhancing mineral prospectivity mapping with geospatial artificial intelligence: A geographically neural network-weighted logistic regression approach. International Journal of Applied Earth Observation and Geoinformation, 128, 103746.
  9. Ding, J., Cen, W., Wu, S., Chen, Y., Qi, J., Huang, B., & Du, Z. (2024). A neural network model to optimize the measure of spatial proximity in geographically weighted regression approach: a case study on house price in Wuhan. International Journal of Geographical Information Science, 1–21.

5. Group

Leaders

Zhenhong DuZhenhong DuPh.DProfessor/ Ph.D SupervisorThe National Science Fund for Distinguished Young ScholarsDean of the School of Earth sciencesZhejiang University
Sensen WuSensen WuPh.DProfessor/Ph.D SupervisorZhejiang University

Members

  • Jin Qi, Postdoctoral fellow, Zhejiang University
  • Jiale Ding, PhD student, Zhejiang University
  • Yi Liu, Undergraduate student, Zhejiang University
  • Ziyu Yin, Undergraduate student, Zhejiang University

6. License

GPLv3 license

Citations:

Du, Z., Wang, Z., Wu, S., Zhang, F., & Liu, R. (2020). Geographically neural network weighted regression for the accurate estimation of spatial non-stationarity. International Journal of Geographical Information Science, 34(7), 1353-1377.

Wu, S., Wang, Z., Du, Z., Huang, B., Zhang, F., & Liu, R. (2021). Geographically and temporally neural network weighted regression for modeling spatiotemporal non-stationary relationships. International Journal of Geographical Information Science , 35(3), 582-608.

Yin, Z., Ding, J., Liu, Y., Wang, R., Wang, Y., Chen, Y., Qi, J., Wu, S., and Du, Z. (2024). GNNWR: an open-source package of spatiotemporal intelligent regression methods for modeling spatial and temporal nonstationarity. Geoscientific Model Development, 17 (22), 8455–8468.