An agnostic framework for geographically weighted learning
Charles University
Spatial non-stationarity is hard.
A common solution?
Geographically Weighted Regression
What about non-linear models?
Most ML implementations are aspatial.
Most spatial models remain linear.
ad-hoc “localising” of specific algorithms
*stolen from Urska Demsar
*stolen from Urska Demsar
“the (not any longer) reproducible code
lives in this (forgotten) repository”
There is no unified framework that
generalises “Geographically Weighted” logic.
An agnostic framework for geographically weighted learning. Written in Python.
agnostic
neighbourhood definition
local estimator
Traditionally defined by Euclidean distance.
Fixed or adaptive (KNN) bandwidth.
What about other ways?
gwlearn allows custom graphs.
network travel time
space-time neighbourhoods
topology of polygon contiguity
…
Typically OLS.
Occasionally something fancier.
gwlearn supports any estimator.
\[ \hat{\theta}(u_i) = \operatorname*{argmin}_{\theta} \sum_{j=1}^{N} w_{ij}(u_i) \cdot \mathcal{L}\Big(y_j, f(X_j, \theta)\Big) \]
linear regression
random forest regressor
gradient boosted classifier
…
modularity
interoperability
flexibility
Defined in libpysal.graph.Graph created prior model fitting.
Any model with scikit-learn compatible API can be used.
gwlearn’s estimators define scikit-learn compatible API.
Training set of local models is as a reusable spatial ensemble.
Three inference strategies:
Housing price in Busan.
An, S., Jang, H., Kim, H. et al. Assessment of street-level greenness and its association with housing prices in a metropolitan area. Sci Rep 13, 22577 (2023). https://doi.org/10.1038/s41598-023-49845-0
bandwidth search across models
linear regression
difference in local \(R^2\) between Euclidean and network graphs
OOS prediction using gradient boosted regressor
gwlearn provides the infrastructure
computation remains a bottleneck
gwlearn provides the missing link
between the rich tradition of GWR
and the modern machine learning
ecosystem.
pysal.org/gwlearn