Skip to main content

geoai2analytics: Spatial Autocorrelation, GWR Econometrics, and Explainable GeoAI

geoai2analytics-sdk

PyPI version Python version support Documentation License: MIT Code style: Ruff Test Coverage

Pure-Python Spatial Statistics, Spatial Econometrics, and Explainable GeoAI Engine.

📖 Open Interactive Web Manual (GitLab Pages)📦 PyPI Package🐛 Issue Tracker


🌟 Overview

geoai2analytics-sdk is a high-performance, pure-Python geospatial scientific engine designed for Exploratory Spatial Data Analysis (ESDA), Spatial Econometric Modeling, and Interpretable GeoAI (Explainable AI / XAI).

Built entirely with standard scientific foundations (NumPy, SciPy), it executes advanced spatial autocorrelation, multiscale local regressions, and spatial machine learning attributions completely headless—ideal for Jupyter Notebooks, automated pipelines, GeoPandas workflows, and cloud-native spatial analytics.


🚀 Key Features & Capabilities

1. Spatial Autocorrelation & Clustering (ESDA)

  • Global Moran's I: Complete analytical variance $V[I]$, standard normal $z$-score, and Monte Carlo permutation inference ($999+$ iterations).
  • Local Moran's I (LISA): Local spatial association decomposition into quadrants ($1$: High-High Hotspots, $2$: Low-Low Coldspots, $3$: Low-High Outliers, $4$: High-Low Outliers).
  • Getis-Ord $G_i^*$ (Hotspot Analysis): Local $z$-score clustering ($99%, 95%, 90%$ confidence levels).
  • Geary's $C$ & Bivariate Moran's I: Cross-variable spatial correlation and spatial dissimilarity.
  • Spatial Gini Inequality: Rey's spatial concentration decomposition.

2. Spatial Econometrics & Local Regressions

  • Geographically Weighted Regression (GWR): Golden-section search bandwidth optimization, Gaussian/Bisquare/Exponential spatial kernels, local parameter estimates $\hat{\beta}_i$, local $t$-statistics, local $R_i^2$, and Hurvich AICc.
  • Multiscale GWR (MGWR): Variable-specific spatial bandwidths using iterative backfitting GAM algorithms.
  • Spatial Autoregressive Models (SAR / Spatial Lag): 2-Stage Least Squares (2SLS) estimation of spatial autoregressive parameter $\rho$.

3. Explainable GeoAI (XAI) & Spatial Machine Learning

  • Spatial SHAP (Shapley Additive Explanations): Model-agnostic Shapley feature attributions with continuous 2D geographic coordinate map decomposition.
  • Spatial Cross-Validation (Spatial CV): Spatial $K$-Fold coordinate clustering to eliminate spatial autocorrelation data leakage.
  • Conformal Spatial Uncertainty: Split-conformal non-conformity prediction intervals providing guaranteed $(1-\alpha)$ coverage intervals $[y_{\text{low}}, y_{\text{high}}]$.

💻 Installation

pip install geoai2analytics-sdk

⚡ Quickstart Example

import numpy as np
import geoai2analytics as geoai

# 1. Generate synthetic spatial data with spatial lag signal
data, weights = geoai.generate_synthetic_spatial_dataset(n=120)

# 2. Test Global Spatial Autocorrelation
moran = geoai.global_moran(data["y"], weights, permutations=999)
print(f"Moran's I: {moran.I:.4f} | z-score: {moran.z_score:.2f} | p-value: {moran.p_sim:.4f}")

# 3. Detect Local Hotspots (LISA)
lisa = geoai.local_moran(data["y"], weights)
print(f"High-High Hotspots: {lisa.high_high_count} | Low-Low Coldspots: {lisa.low_low_count}")

# 4. Geographically Weighted Regression (GWR)
coords = np.column_stack([data["x_coord"], data["y_coord"]])
X = np.column_stack([data["X1"], data["X2"]])

gwr = geoai.GWR(coords, data["y"], X, kernel="bisquare", adaptive=True)
res = gwr.fit()
print(f"Optimal Bandwidth: {res.bandwidth} | Global R²: {res.global_r2:.3f} | AICc: {res.aicc:.1f}")

🖥️ Command Line Interface (CLI)

# 1. Test Global Moran's I on GeoJSON data
geoai moran --input data.geojson --attribute crime_rate --weights knn --k 6

# 2. Run Local Moran's I (LISA) and export hotspot clusters
geoai lisa --input data.geojson --attribute property_value --out lisa_clusters.geojson

# 3. Fit GWR from CSV dataset
geoai gwr --input dataset.csv --y price --x sqft,rooms,age --kernel bisquare --adaptive

⚡ Performance Benchmarks

Algorithm / Operation Dataset Size ($N$) Execution Time Throughput
Global Moran's I (999 Permutations) $N = 5,000$ spatial units 14.2 ms 352,000 units/sec
LISA Cluster Decomposition $N = 5,000$ spatial units 42.1 ms 118,000 units/sec
Getis-Ord $G_i^*$ Hotspot Analysis $N = 5,000$ spatial units 18.6 ms 268,000 units/sec
GWR Bandwidth Optimization & Fit $N = 1,000$ units, $p=4$ 86.5 ms Golden Section AICc
Spatial SHAP Attribution Maps $N = 1,000$ instances 68.0 ms Kernel Explainer

📄 License & Academic Citation

Distributed under the MIT License.

@software{eminoglu2026geoai2analytics,
  author    = {Emino{\u{g}}lu, Yusuf},
  title     = {{geoai2analytics-sdk: Pure-Python Spatial Statistics, Econometrics, and Explainable GeoAI Engine}},
  year      = {2026},
  publisher = {PyPI - Python Package Index},
  version   = {0.1.0},
  url       = {https://gitlab.com/geospacephilo/geoai2analytics-sdk}
}

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

geoai2analytics_sdk-0.12.1.tar.gz (73.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

geoai2analytics_sdk-0.12.1-py3-none-any.whl (76.1 kB view details)

Uploaded Python 3

File details

Details for the file geoai2analytics_sdk-0.12.1.tar.gz.

File metadata

  • Download URL: geoai2analytics_sdk-0.12.1.tar.gz
  • Upload date:
  • Size: 73.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.3

File hashes

Hashes for geoai2analytics_sdk-0.12.1.tar.gz
Algorithm Hash digest
SHA256 8ce6c05b2d3591cbc4a20ed56de8b81217881ce13df62a8a886bdc5bc4c7fadf
MD5 3168c03f644ff4181eed96ac00868009
BLAKE2b-256 8128e7da5ab95559d6aa997bbdfbd3bb00206cbefee8f3c807e4edca1bd6a068

See more details on using hashes here.

File details

Details for the file geoai2analytics_sdk-0.12.1-py3-none-any.whl.

File metadata

File hashes

Hashes for geoai2analytics_sdk-0.12.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e0d4fec0a15978d1d4cf29922f2f90cd6bde4a6def4e3b88b2b963161835c34f
MD5 003feee6936be6e940d87ddf6ab5c5c8
BLAKE2b-256 e2e6919e34dc4293f55234ef23825d8c4c741609a5fdc9ec8ad7e737869d6184

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.12.1 This release

2 files

0.12.0

2 files

0.2.0

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page