pyGWRx¶
Geographically
weighted modelling,
refined for research.
pyGWRx is a Python toolkit for spatially varying relationships—
multiscale, robust, and extensible.
Move from question to result
The documentation is organized around the task you are trying to complete—not around the internal file structure of the package.
Build the foundations
Understand spatial weights, kernels, bandwidths, coordinates, local calibration, and result interpretation.
Getting started → 02 · SELECTChoose the right model
Compare 19 model families by response type, spatial scale, temporal structure, prediction support, and assumptions.
Model handbook → 03 · BUILDRun complete workflows
Use 45 maintained scripts covering every model, every public function group, diagnostics, plotting, and I/O.
Runnable examples → 04 · REFERENCEInspect the public contract
Browse signatures, parameters, return objects, docstrings, source links, and mapped example code for 174 APIs.
API reference →One workflow across five layers
Models share a consistent research workflow: fit, inspect, diagnose, visualize, and report—with capability boundaries documented rather than hidden.
Models
Regression, classification, transformation, local statistics, and inference families.
Core numerics
Kernels, distances, local solvers, bandwidth search, metrics, optimization, and validation.
Diagnostics
Residuals, influence, inference, local collinearity, temporal structure, weights, and regimes.
Visualization
Fifty-six model-aware and array-based plotting functions returning Matplotlib objects.
I/O and examples
NumPy/pandas-first contracts, built-in GeoDataFrame integration, persistence, and reproducible examples.
from pygwrx import GWR
from pygwrx.diagnostics import diagnostics_frame
from pygwrx.plotting import plot_diagnostic_panel
model = GWR(
kernel="bisquare",
bandwidth=48,
adaptive=True,
)
model.fit(X, y, coords)
print(model.summary())
print(diagnostics_frame([model], labels=["GWR"]))
fig, axes = plot_diagnostic_panel(model, theme="paper")
fig.savefig("gwr_diagnostics.png", dpi=200)Start from the scientific structure
Begin with the simplest model that matches the response and spatial process, then add complexity only when diagnostics and theory justify it.
Core local regression
Continuous responses with spatially varying relationships.
Robust and regularized
Outliers, instability, local collinearity, and sparse effects.
Generalized and categorical
Counts, binary outcomes, and locally varying classes.
Space and time
Row-wise timestamps, historical stages, and parameter-specific scales.
Multivariate and scalable
Local structure, descriptive statistics, inference, and larger samples.
Similarity and research models
Functional neighbourhoods, latent geometry, and connected regimes.
Designed to make assumptions visible
Explicit capability boundaries
Prediction, transformation, classification, statistics, and inference are documented as different operations—not presented as interchangeable estimators.
Examples as a public contract
Every public API is mapped to a maintained example, with automated 174/174 coverage validation.
Reproducible engineering
Deterministic example data, strict documentation builds, typed result objects, isolated optional dependencies, and reference comparisons where available.
Ready to fit your first local model?
Install the base package, run the five-minute workflow, then use diagnostics before adding model complexity.