A pytorch implementation of the Geographically Neural Network Weighted Regression (GNNWR)
Project description
gnnwr
A pytorch implementation of the Geographically Neural Network Weighted Regression (GNNWR) and its derived models
This repository contains:
- Source code of GNNWR, GTNNWR model and other derived models
- Tutorial notebooks of how to use these model
- Released Python wheels
Table of Contents
Models
- GNNWR: Geographically neural network weighted regression, a model address spatial non-stationarity in various domains with complex geographical processes. A spatially weighted neural network (SWNN) is proposed to represent the nonstationary weight matrix.
- GTNNWR: Geographically and temporally neural network weighted regression, a model for estimating spatiotemporal non-stationary relationships. A spatiotemporal proximity neural network (STPNN) is proposed in this paper to accurately generate space-time distance.
Install
⚠ If you want to run gnnwr with your GPU, make sure you have installed pytorch with CUDA support beforehead:
For example, a torch 1.13.1 with cuda 11.7:
> pip list | grep torch
torch 1.13.1+cu117
You can find install support on Pytorch's official website for installing the right version that suits your environment.
⚠ If you only want to run gnnwr with your CPU, or you have already installed the correct version of pytorch:
Using pip to install gnnwr:
pip install gnnwr
Usage
We provide a series of encapsulated methods and predefined default parameters, users only need to use to load dataset with pandas , and call the functions in gnnwr package to complete the regression:
from gnnwr import models,datasets
import pandas as pd
data = pd.read_csv('your_data.csv')
train_dataset, val_dataset, test_dataset = datasets.init_dataset(data=data,
test_ratio=0.2, valid_ratio=0.1,
x_column=['x1', 'x2'], y_column=['y'],
spatial_column=['u', 'v'])
gnnwr = models.GNNWR(train_dataset, val_dataset, test_dataset)
gnnwr.run(100)
For other uses of customization, the demos can be referred to.
Reference
algorithm
- Du, Z., Wang, Z., Wu, S., Zhang, F., and 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., and 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.
case study demo
- Jin Qi, Zhenhong Du, Sensen Wu, Yijun Chen, Yuanyuan Wang, 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.
Contributing
Contributors
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gnnwr-0.0.7.tar.gz.
File metadata
- Download URL: gnnwr-0.0.7.tar.gz
- Upload date:
- Size: 31.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
785452987c413a4ff9868f536b5bbee4519be20834c4df8c84c19bf09da93c7b
|
|
| MD5 |
0983a49601befa4b5576e180d6b92ee9
|
|
| BLAKE2b-256 |
7ecd76e6ca6cda31f4b070f86052f253b9a5d6d9c9940b1918637309a2fadb3d
|
File details
Details for the file gnnwr-0.0.7-py3-none-any.whl.
File metadata
- Download URL: gnnwr-0.0.7-py3-none-any.whl
- Upload date:
- Size: 30.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3c1afc178c89fc1865c0fd7d05037a8128375b4c85c4c25ebe463ed15f4b05f2
|
|
| MD5 |
eaeb840626ec170d627b5b924e892d7f
|
|
| BLAKE2b-256 |
b1e8e879240dae1f86c9e722c67c877047091f77eff305c6349ca2396ad3e9b4
|