Skip to main content

geoai2analytics: Spatial Autocorrelation, GWR Econometrics, and Explainable GeoAI

geoai2analytics-sdk

CI 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 (GitHub 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://github.com/YusufEminoglu/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.2.0.tar.gz (39.1 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.2.0-py3-none-any.whl (37.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: geoai2analytics_sdk-0.2.0.tar.gz
  • Upload date:
  • Size: 39.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for geoai2analytics_sdk-0.2.0.tar.gz
Algorithm Hash digest
SHA256 f8a581d645959edd26b8fd3e7ab93470c50a7a2f770f4e00c8d7bbf73176bcef
MD5 cf25ca79adc2e08137474833daefd2da
BLAKE2b-256 e185c2b7229331319d3cabc7b73d1480899a14a06f07a12b68f5b347a38d5d40

See more details on using hashes here.

Provenance

The following attestation bundles were made for geoai2analytics_sdk-0.2.0.tar.gz:

Publisher: publish.yml on YusufEminoglu/geoai2analytics-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

File hashes

Hashes for geoai2analytics_sdk-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 baa086be5cf825cd61852d682def14f1f3b07d282c22b38e1562d2cec30eabcd
MD5 082bdd7657fc22c187b5c4757ac591bd
BLAKE2b-256 f56fd1d3f0cb29677eb86495bb300b474d50f78016c2e179b8f1c60dc1db24b9

See more details on using hashes here.

Provenance

The following attestation bundles were made for geoai2analytics_sdk-0.2.0-py3-none-any.whl:

Publisher: publish.yml on YusufEminoglu/geoai2analytics-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.12.1

2 files

0.12.0

2 files

This release

0.2.0 This release

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