-
Notifications
You must be signed in to change notification settings - Fork 105
Description
As discussed in
GWLearn's issue: pysal/gwlearn#69
To perform spatiotemporal regression (GTWR), users currently have to manually build separate spatial and temporal graphs, intersect them, and handle the weight multiplication themselves. This is very complicated.
There's a need for adding a first class method to handle spatio-temporal weight construction.
We can likely use the "Product of Kernels" approach (
Few options I'd like to mention (totally open for more, for a more cleaner API)
Graph.build_spatiotemporal
A dedicated constructor that takes both spatial and temporal data.
st_graph = Graph.build_spatiotemporal(
gdf,
t_values,
spatial_k=50,
temporal_bandwidth=365
)- Hadamard Product (
Graph.multiply)
A more general method that allows scaling weights of one graph by those of another (assuming matching edges/indices).
spatial_graph = Graph.build_knn(gdf, k=50)
temporal_graph = Graph.build_kernel(t_values, bandwidth=365)
st_graph = spatial_graph.multiply(temporal_graph)Moving this to libpysal ensures:
A clean, "PySAL-ic" API that favors composition.
Cross-package compatibility (e.g., gwlearn and esda can both use the same ST graph logic). Libraries like gwlearn or esda can focus on modeling/statistics rather than.. having an unnecessary graph intersection logics