| name | gnnwr |
| description | Spatial and spatiotemporal regression with GNNWR (Geographically Neural Network
Weighted Regression). Use when Claude needs to: (1) Build spatially varying coefficient
regression models, (2) Analyze geographic non-stationarity in spatial data,
(3) Generate spatial coefficient maps for publication, (4) Run spatiotemporal
regression with GTNNWR, (5) Scale geographically weighted regression to large
datasets (N > 10k) with KNN mode, (6) Diagnose spatial model performance with
F-tests, AIC, and residual maps.
|
| version | 1.0.0 |
| author | Geoscience Skills |
| license | MIT |
| tags | ["Spatial Regression","GNNWR","GTNNWR","GWR","Non-Stationarity","Coefficient Mapping","Spatial Analysis","Geographic Weighting"] |
| dependencies | ["gnnwr>=0.1.0","pandas","torch"] |
| complements | ["verde","geostatspy","scikit-gstat","pyvista","xarray"] |
| workflow_role | analysis |
GNNWR - Geographically Neural Network Weighted Regression
Quick Reference
from gnnwr import models, datasets, utils
import pandas as pd
data = pd.read_csv("data.csv")
train, val, test = datasets.init_dataset(
data=data, test_ratio=0.2, valid_ratio=0.1,
x_column=["x1", "x2", "x3"], y_column=["y"],
spatial_column=["lon", "lat"],
batch_size=32, process_fn="minmax_scale"
)
model = models.GNNWR(train, val, test, use_gpu=True, optimizer="Adam", start_lr=0.01)
model.run(max_epoch=200, early_stop=30)
result = model.reg_result(only_return=True)
print(model.result())
Spatiotemporal (GTNNWR)
train, val, test = datasets.init_dataset(
data=data, ...,
spatial_column=["lon", "lat"],
temp_column=["year", "month"],
use_model="gtnnwr"
)
model = models.GTNNWR(train, val, test, use_gpu=True)
Large-Scale (N > 10k) — KNN Mode
train, val, test = datasets.init_dataset(
data=data, ..., knn_k=500
)
Key Classes