geoai2analytics-sdk 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- geoai2analytics_sdk-0.1.0/LICENSE +21 -0
- geoai2analytics_sdk-0.1.0/PKG-INFO +146 -0
- geoai2analytics_sdk-0.1.0/README.md +103 -0
- geoai2analytics_sdk-0.1.0/pyproject.toml +109 -0
- geoai2analytics_sdk-0.1.0/setup.cfg +4 -0
- geoai2analytics_sdk-0.1.0/src/geoai2analytics/__init__.py +111 -0
- geoai2analytics_sdk-0.1.0/src/geoai2analytics/autocorr.py +390 -0
- geoai2analytics_sdk-0.1.0/src/geoai2analytics/cli.py +86 -0
- geoai2analytics_sdk-0.1.0/src/geoai2analytics/econometrics.py +399 -0
- geoai2analytics_sdk-0.1.0/src/geoai2analytics/geoai_xai.py +193 -0
- geoai2analytics_sdk-0.1.0/src/geoai2analytics/py.typed +1 -0
- geoai2analytics_sdk-0.1.0/src/geoai2analytics/weights.py +159 -0
- geoai2analytics_sdk-0.1.0/src/geoai2analytics_sdk.egg-info/PKG-INFO +146 -0
- geoai2analytics_sdk-0.1.0/src/geoai2analytics_sdk.egg-info/SOURCES.txt +17 -0
- geoai2analytics_sdk-0.1.0/src/geoai2analytics_sdk.egg-info/dependency_links.txt +1 -0
- geoai2analytics_sdk-0.1.0/src/geoai2analytics_sdk.egg-info/entry_points.txt +2 -0
- geoai2analytics_sdk-0.1.0/src/geoai2analytics_sdk.egg-info/requires.txt +15 -0
- geoai2analytics_sdk-0.1.0/src/geoai2analytics_sdk.egg-info/top_level.txt +1 -0
- geoai2analytics_sdk-0.1.0/tests/test_all_algorithms.py +153 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Yusuf Eminoğlu
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: geoai2analytics-sdk
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Pure-Python Spatial Statistics, Econometrics, and Explainable GeoAI Engine.
|
|
5
|
+
Author-email: Yusuf Eminoğlu <yusufeminoglu@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/YusufEminoglu/geoai2analytics-sdk
|
|
8
|
+
Project-URL: Repository, https://github.com/YusufEminoglu/geoai2analytics-sdk
|
|
9
|
+
Project-URL: Issues, https://github.com/YusufEminoglu/geoai2analytics-sdk/issues
|
|
10
|
+
Project-URL: Documentation, https://yusufeminoglu.github.io/geoai2analytics-sdk/
|
|
11
|
+
Project-URL: Changelog, https://github.com/YusufEminoglu/geoai2analytics-sdk/blob/main/CHANGELOG.md
|
|
12
|
+
Keywords: spatial-statistics,spatial-econometrics,geoai,gwr,mgwr,lisa,morans-i,spatial-autocorrelation,shap,xai,conformal-prediction,spatial-weights,gis,urban-analytics
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Operating System :: OS Independent
|
|
21
|
+
Classifier: Topic :: Scientific/Engineering :: GIS
|
|
22
|
+
Classifier: Topic :: Scientific/Engineering :: Information Analysis
|
|
23
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
24
|
+
Classifier: Intended Audience :: Developers
|
|
25
|
+
Classifier: Intended Audience :: Science/Research
|
|
26
|
+
Requires-Python: >=3.9
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
License-File: LICENSE
|
|
29
|
+
Requires-Dist: numpy>=1.20.0
|
|
30
|
+
Provides-Extra: geo
|
|
31
|
+
Requires-Dist: scipy>=1.7.0; extra == "geo"
|
|
32
|
+
Requires-Dist: shapely>=2.0.0; extra == "geo"
|
|
33
|
+
Requires-Dist: geopandas>=0.12.0; extra == "geo"
|
|
34
|
+
Requires-Dist: scikit-learn>=1.0.0; extra == "geo"
|
|
35
|
+
Provides-Extra: dev
|
|
36
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
37
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
38
|
+
Requires-Dist: ruff>=0.1.0; extra == "dev"
|
|
39
|
+
Requires-Dist: mypy>=1.0.0; extra == "dev"
|
|
40
|
+
Requires-Dist: build>=1.0.0; extra == "dev"
|
|
41
|
+
Requires-Dist: twine>=5.0.0; extra == "dev"
|
|
42
|
+
Dynamic: license-file
|
|
43
|
+
|
|
44
|
+
<div align="center">
|
|
45
|
+
|
|
46
|
+
<a href="https://yusufeminoglu.github.io/geoai2analytics-sdk/">
|
|
47
|
+
<img src="https://raw.githubusercontent.com/YusufEminoglu/geoai2analytics-sdk/main/docs/icons/logo.svg" width="140" height="140" alt="geoai2analytics logo" />
|
|
48
|
+
</a>
|
|
49
|
+
|
|
50
|
+
# geoai2analytics-sdk
|
|
51
|
+
|
|
52
|
+
[](https://github.com/YusufEminoglu/geoai2analytics-sdk/actions/workflows/ci.yml)
|
|
53
|
+
[](https://pypi.org/project/geoai2analytics-sdk/)
|
|
54
|
+
[](https://pypi.org/project/geoai2analytics-sdk/)
|
|
55
|
+
[](https://yusufeminoglu.github.io/geoai2analytics-sdk/)
|
|
56
|
+
[](LICENSE)
|
|
57
|
+
[](https://docs.astral.sh/ruff/)
|
|
58
|
+
[](#-tests-and-quality-assurance)
|
|
59
|
+
|
|
60
|
+
**Pure-Python Spatial Statistics, Econometrics, and Explainable GeoAI Engine.**
|
|
61
|
+
|
|
62
|
+
[📖 **Open Interactive Web Manual (GitHub Pages)**](https://yusufeminoglu.github.io/geoai2analytics-sdk/) • [📦 **PyPI Package**](https://pypi.org/project/geoai2analytics-sdk/) • [🐛 **Issue Tracker**](https://github.com/YusufEminoglu/geoai2analytics-sdk/issues)
|
|
63
|
+
|
|
64
|
+
</div>
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## 🌟 Overview
|
|
69
|
+
|
|
70
|
+
**`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)**.
|
|
71
|
+
|
|
72
|
+
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.
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## 🚀 Key Features & Capabilities
|
|
77
|
+
|
|
78
|
+
### 1. Spatial Autocorrelation & Clustering (ESDA)
|
|
79
|
+
* **Global Moran's I**: Complete analytical variance $V[I]$, standard normal $z$-score, and Monte Carlo permutation inference ($999+$ iterations).
|
|
80
|
+
* **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).
|
|
81
|
+
* **Getis-Ord $G_i^*$ (Hotspot Analysis)**: Local $z$-score clustering ($99\%, 95\%, 90\%$ confidence levels).
|
|
82
|
+
* **Geary's $C$ & Bivariate Moran's I**: Cross-variable spatial correlation and spatial dissimilarity.
|
|
83
|
+
* **Spatial Gini Inequality**: Rey's spatial concentration decomposition.
|
|
84
|
+
|
|
85
|
+
### 2. Spatial Econometrics & Local Regressions
|
|
86
|
+
* **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.
|
|
87
|
+
* **Multiscale GWR (MGWR)**: Variable-specific spatial bandwidths using iterative backfitting GAM algorithms.
|
|
88
|
+
* **Spatial Autoregressive Models (SAR / Spatial Lag)**: 2-Stage Least Squares (2SLS) estimation of spatial autoregressive parameter $\rho$.
|
|
89
|
+
|
|
90
|
+
### 3. Explainable GeoAI (XAI) & Spatial Machine Learning
|
|
91
|
+
* **Spatial SHAP (Shapley Additive Explanations)**: Model-agnostic Shapley feature attributions with continuous 2D geographic coordinate map decomposition.
|
|
92
|
+
* **Spatial Cross-Validation (Spatial CV)**: Spatial $K$-Fold coordinate clustering to eliminate spatial autocorrelation data leakage.
|
|
93
|
+
* **Conformal Spatial Uncertainty**: Split-conformal non-conformity prediction intervals providing guaranteed $(1-\alpha)$ coverage intervals $[y_{\text{low}}, y_{\text{high}}]$.
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## 💻 Installation
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
pip install geoai2analytics-sdk
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## ⚡ Quickstart Example
|
|
106
|
+
|
|
107
|
+
```python
|
|
108
|
+
import numpy as np
|
|
109
|
+
import geoai2analytics as geoai
|
|
110
|
+
|
|
111
|
+
# 1. Generate synthetic spatial data with spatial lag signal
|
|
112
|
+
data, weights = geoai.generate_synthetic_spatial_dataset(n=120)
|
|
113
|
+
|
|
114
|
+
# 2. Test Global Spatial Autocorrelation
|
|
115
|
+
moran = geoai.global_moran(data["y"], weights, permutations=999)
|
|
116
|
+
print(f"Moran's I: {moran.I:.4f} | z-score: {moran.z_score:.2f} | p-value: {moran.p_sim:.4f}")
|
|
117
|
+
|
|
118
|
+
# 3. Detect Local Hotspots (LISA)
|
|
119
|
+
lisa = geoai.local_moran(data["y"], weights)
|
|
120
|
+
print(f"High-High Hotspots: {lisa.high_high_count} | Low-Low Coldspots: {lisa.low_low_count}")
|
|
121
|
+
|
|
122
|
+
# 4. Geographically Weighted Regression (GWR)
|
|
123
|
+
coords = np.column_stack([data["x_coord"], data["y_coord"]])
|
|
124
|
+
X = np.column_stack([data["X1"], data["X2"]])
|
|
125
|
+
|
|
126
|
+
gwr = geoai.GWR(coords, data["y"], X, kernel="bisquare", adaptive=True)
|
|
127
|
+
res = gwr.fit()
|
|
128
|
+
print(f"Optimal Bandwidth: {res.bandwidth} | Global R²: {res.global_r2:.3f} | AICc: {res.aicc:.1f}")
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## 📄 License & Academic Citation
|
|
134
|
+
|
|
135
|
+
Distributed under the **MIT License**.
|
|
136
|
+
|
|
137
|
+
```bibtex
|
|
138
|
+
@software{eminoglu2026geoai2analytics,
|
|
139
|
+
author = {Emino{\u{g}}lu, Yusuf},
|
|
140
|
+
title = {{geoai2analytics-sdk: Pure-Python Spatial Statistics, Econometrics, and Explainable GeoAI Engine}},
|
|
141
|
+
year = {2026},
|
|
142
|
+
publisher = {PyPI - Python Package Index},
|
|
143
|
+
version = {0.1.0},
|
|
144
|
+
url = {https://github.com/YusufEminoglu/geoai2analytics-sdk}
|
|
145
|
+
}
|
|
146
|
+
```
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
<a href="https://yusufeminoglu.github.io/geoai2analytics-sdk/">
|
|
4
|
+
<img src="https://raw.githubusercontent.com/YusufEminoglu/geoai2analytics-sdk/main/docs/icons/logo.svg" width="140" height="140" alt="geoai2analytics logo" />
|
|
5
|
+
</a>
|
|
6
|
+
|
|
7
|
+
# geoai2analytics-sdk
|
|
8
|
+
|
|
9
|
+
[](https://github.com/YusufEminoglu/geoai2analytics-sdk/actions/workflows/ci.yml)
|
|
10
|
+
[](https://pypi.org/project/geoai2analytics-sdk/)
|
|
11
|
+
[](https://pypi.org/project/geoai2analytics-sdk/)
|
|
12
|
+
[](https://yusufeminoglu.github.io/geoai2analytics-sdk/)
|
|
13
|
+
[](LICENSE)
|
|
14
|
+
[](https://docs.astral.sh/ruff/)
|
|
15
|
+
[](#-tests-and-quality-assurance)
|
|
16
|
+
|
|
17
|
+
**Pure-Python Spatial Statistics, Econometrics, and Explainable GeoAI Engine.**
|
|
18
|
+
|
|
19
|
+
[📖 **Open Interactive Web Manual (GitHub Pages)**](https://yusufeminoglu.github.io/geoai2analytics-sdk/) • [📦 **PyPI Package**](https://pypi.org/project/geoai2analytics-sdk/) • [🐛 **Issue Tracker**](https://github.com/YusufEminoglu/geoai2analytics-sdk/issues)
|
|
20
|
+
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## 🌟 Overview
|
|
26
|
+
|
|
27
|
+
**`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)**.
|
|
28
|
+
|
|
29
|
+
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.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## 🚀 Key Features & Capabilities
|
|
34
|
+
|
|
35
|
+
### 1. Spatial Autocorrelation & Clustering (ESDA)
|
|
36
|
+
* **Global Moran's I**: Complete analytical variance $V[I]$, standard normal $z$-score, and Monte Carlo permutation inference ($999+$ iterations).
|
|
37
|
+
* **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).
|
|
38
|
+
* **Getis-Ord $G_i^*$ (Hotspot Analysis)**: Local $z$-score clustering ($99\%, 95\%, 90\%$ confidence levels).
|
|
39
|
+
* **Geary's $C$ & Bivariate Moran's I**: Cross-variable spatial correlation and spatial dissimilarity.
|
|
40
|
+
* **Spatial Gini Inequality**: Rey's spatial concentration decomposition.
|
|
41
|
+
|
|
42
|
+
### 2. Spatial Econometrics & Local Regressions
|
|
43
|
+
* **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.
|
|
44
|
+
* **Multiscale GWR (MGWR)**: Variable-specific spatial bandwidths using iterative backfitting GAM algorithms.
|
|
45
|
+
* **Spatial Autoregressive Models (SAR / Spatial Lag)**: 2-Stage Least Squares (2SLS) estimation of spatial autoregressive parameter $\rho$.
|
|
46
|
+
|
|
47
|
+
### 3. Explainable GeoAI (XAI) & Spatial Machine Learning
|
|
48
|
+
* **Spatial SHAP (Shapley Additive Explanations)**: Model-agnostic Shapley feature attributions with continuous 2D geographic coordinate map decomposition.
|
|
49
|
+
* **Spatial Cross-Validation (Spatial CV)**: Spatial $K$-Fold coordinate clustering to eliminate spatial autocorrelation data leakage.
|
|
50
|
+
* **Conformal Spatial Uncertainty**: Split-conformal non-conformity prediction intervals providing guaranteed $(1-\alpha)$ coverage intervals $[y_{\text{low}}, y_{\text{high}}]$.
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## 💻 Installation
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
pip install geoai2analytics-sdk
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## ⚡ Quickstart Example
|
|
63
|
+
|
|
64
|
+
```python
|
|
65
|
+
import numpy as np
|
|
66
|
+
import geoai2analytics as geoai
|
|
67
|
+
|
|
68
|
+
# 1. Generate synthetic spatial data with spatial lag signal
|
|
69
|
+
data, weights = geoai.generate_synthetic_spatial_dataset(n=120)
|
|
70
|
+
|
|
71
|
+
# 2. Test Global Spatial Autocorrelation
|
|
72
|
+
moran = geoai.global_moran(data["y"], weights, permutations=999)
|
|
73
|
+
print(f"Moran's I: {moran.I:.4f} | z-score: {moran.z_score:.2f} | p-value: {moran.p_sim:.4f}")
|
|
74
|
+
|
|
75
|
+
# 3. Detect Local Hotspots (LISA)
|
|
76
|
+
lisa = geoai.local_moran(data["y"], weights)
|
|
77
|
+
print(f"High-High Hotspots: {lisa.high_high_count} | Low-Low Coldspots: {lisa.low_low_count}")
|
|
78
|
+
|
|
79
|
+
# 4. Geographically Weighted Regression (GWR)
|
|
80
|
+
coords = np.column_stack([data["x_coord"], data["y_coord"]])
|
|
81
|
+
X = np.column_stack([data["X1"], data["X2"]])
|
|
82
|
+
|
|
83
|
+
gwr = geoai.GWR(coords, data["y"], X, kernel="bisquare", adaptive=True)
|
|
84
|
+
res = gwr.fit()
|
|
85
|
+
print(f"Optimal Bandwidth: {res.bandwidth} | Global R²: {res.global_r2:.3f} | AICc: {res.aicc:.1f}")
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## 📄 License & Academic Citation
|
|
91
|
+
|
|
92
|
+
Distributed under the **MIT License**.
|
|
93
|
+
|
|
94
|
+
```bibtex
|
|
95
|
+
@software{eminoglu2026geoai2analytics,
|
|
96
|
+
author = {Emino{\u{g}}lu, Yusuf},
|
|
97
|
+
title = {{geoai2analytics-sdk: Pure-Python Spatial Statistics, Econometrics, and Explainable GeoAI Engine}},
|
|
98
|
+
year = {2026},
|
|
99
|
+
publisher = {PyPI - Python Package Index},
|
|
100
|
+
version = {0.1.0},
|
|
101
|
+
url = {https://github.com/YusufEminoglu/geoai2analytics-sdk}
|
|
102
|
+
}
|
|
103
|
+
```
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "geoai2analytics-sdk"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
authors = [
|
|
9
|
+
{ name = "Yusuf Eminoğlu", email = "yusufeminoglu@gmail.com" }
|
|
10
|
+
]
|
|
11
|
+
description = "Pure-Python Spatial Statistics, Econometrics, and Explainable GeoAI Engine."
|
|
12
|
+
readme = "README.md"
|
|
13
|
+
license = "MIT"
|
|
14
|
+
requires-python = ">=3.9"
|
|
15
|
+
keywords = [
|
|
16
|
+
"spatial-statistics",
|
|
17
|
+
"spatial-econometrics",
|
|
18
|
+
"geoai",
|
|
19
|
+
"gwr",
|
|
20
|
+
"mgwr",
|
|
21
|
+
"lisa",
|
|
22
|
+
"morans-i",
|
|
23
|
+
"spatial-autocorrelation",
|
|
24
|
+
"shap",
|
|
25
|
+
"xai",
|
|
26
|
+
"conformal-prediction",
|
|
27
|
+
"spatial-weights",
|
|
28
|
+
"gis",
|
|
29
|
+
"urban-analytics",
|
|
30
|
+
]
|
|
31
|
+
classifiers = [
|
|
32
|
+
"Development Status :: 4 - Beta",
|
|
33
|
+
"Programming Language :: Python :: 3",
|
|
34
|
+
"Programming Language :: Python :: 3.9",
|
|
35
|
+
"Programming Language :: Python :: 3.10",
|
|
36
|
+
"Programming Language :: Python :: 3.11",
|
|
37
|
+
"Programming Language :: Python :: 3.12",
|
|
38
|
+
"Programming Language :: Python :: 3.13",
|
|
39
|
+
"Operating System :: OS Independent",
|
|
40
|
+
"Topic :: Scientific/Engineering :: GIS",
|
|
41
|
+
"Topic :: Scientific/Engineering :: Information Analysis",
|
|
42
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
43
|
+
"Intended Audience :: Developers",
|
|
44
|
+
"Intended Audience :: Science/Research",
|
|
45
|
+
]
|
|
46
|
+
dependencies = [
|
|
47
|
+
"numpy>=1.20.0",
|
|
48
|
+
]
|
|
49
|
+
|
|
50
|
+
[project.optional-dependencies]
|
|
51
|
+
geo = [
|
|
52
|
+
"scipy>=1.7.0",
|
|
53
|
+
"shapely>=2.0.0",
|
|
54
|
+
"geopandas>=0.12.0",
|
|
55
|
+
"scikit-learn>=1.0.0",
|
|
56
|
+
]
|
|
57
|
+
dev = [
|
|
58
|
+
"pytest>=7.0.0",
|
|
59
|
+
"pytest-cov>=4.0.0",
|
|
60
|
+
"ruff>=0.1.0",
|
|
61
|
+
"mypy>=1.0.0",
|
|
62
|
+
"build>=1.0.0",
|
|
63
|
+
"twine>=5.0.0",
|
|
64
|
+
]
|
|
65
|
+
|
|
66
|
+
[project.scripts]
|
|
67
|
+
geoai2analytics = "geoai2analytics.cli:main"
|
|
68
|
+
|
|
69
|
+
[project.urls]
|
|
70
|
+
Homepage = "https://github.com/YusufEminoglu/geoai2analytics-sdk"
|
|
71
|
+
Repository = "https://github.com/YusufEminoglu/geoai2analytics-sdk"
|
|
72
|
+
Issues = "https://github.com/YusufEminoglu/geoai2analytics-sdk/issues"
|
|
73
|
+
Documentation = "https://yusufeminoglu.github.io/geoai2analytics-sdk/"
|
|
74
|
+
Changelog = "https://github.com/YusufEminoglu/geoai2analytics-sdk/blob/main/CHANGELOG.md"
|
|
75
|
+
|
|
76
|
+
[tool.setuptools]
|
|
77
|
+
package-dir = {"" = "src"}
|
|
78
|
+
|
|
79
|
+
[tool.setuptools.packages.find]
|
|
80
|
+
where = ["src"]
|
|
81
|
+
|
|
82
|
+
[tool.setuptools.package-data]
|
|
83
|
+
geoai2analytics = ["py.typed"]
|
|
84
|
+
|
|
85
|
+
[tool.ruff]
|
|
86
|
+
line-length = 100
|
|
87
|
+
target-version = "py39"
|
|
88
|
+
exclude = [
|
|
89
|
+
".venv",
|
|
90
|
+
"build",
|
|
91
|
+
"dist",
|
|
92
|
+
"build_geoai2analytics_docs.py",
|
|
93
|
+
]
|
|
94
|
+
|
|
95
|
+
[tool.ruff.lint]
|
|
96
|
+
select = ["E", "F", "W", "I", "B", "C4"]
|
|
97
|
+
ignore = ["E501"]
|
|
98
|
+
|
|
99
|
+
[tool.pytest.ini_options]
|
|
100
|
+
testpaths = ["tests"]
|
|
101
|
+
pythonpath = ["src"]
|
|
102
|
+
|
|
103
|
+
[tool.coverage.run]
|
|
104
|
+
source = ["geoai2analytics"]
|
|
105
|
+
branch = true
|
|
106
|
+
|
|
107
|
+
[tool.coverage.report]
|
|
108
|
+
show_missing = true
|
|
109
|
+
fail_under = 70
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""
|
|
3
|
+
geoai2analytics — Pure-Python Spatial Statistics, Econometrics, and Explainable GeoAI Engine.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
__version__ = "0.1.0"
|
|
9
|
+
__author__ = "Yusuf Eminoğlu"
|
|
10
|
+
|
|
11
|
+
from .autocorr import (
|
|
12
|
+
BivariateMoranResult,
|
|
13
|
+
GearyCResult,
|
|
14
|
+
GlobalMoranResult,
|
|
15
|
+
LocalGetisOrdResult,
|
|
16
|
+
LocalMoranResult,
|
|
17
|
+
SpatialGiniResult,
|
|
18
|
+
bivariate_moran,
|
|
19
|
+
global_moran,
|
|
20
|
+
local_getis_ord_gi_star,
|
|
21
|
+
local_moran,
|
|
22
|
+
spatial_gini,
|
|
23
|
+
)
|
|
24
|
+
from .econometrics import (
|
|
25
|
+
GWR,
|
|
26
|
+
MGWR,
|
|
27
|
+
GWRResult,
|
|
28
|
+
MGWRResult,
|
|
29
|
+
SpatialLagResult,
|
|
30
|
+
fit_spatial_lag,
|
|
31
|
+
)
|
|
32
|
+
from .geoai_xai import (
|
|
33
|
+
ConformalPredictionInterval,
|
|
34
|
+
ConformalPredictor,
|
|
35
|
+
SpatialCrossValidator,
|
|
36
|
+
SpatialCVFold,
|
|
37
|
+
SpatialSHAP,
|
|
38
|
+
SpatialSHAPResult,
|
|
39
|
+
)
|
|
40
|
+
from .weights import (
|
|
41
|
+
SpatialWeights,
|
|
42
|
+
distance_band_weights,
|
|
43
|
+
grid_weights,
|
|
44
|
+
knn_weights,
|
|
45
|
+
row_standardize,
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def generate_synthetic_spatial_dataset(
|
|
50
|
+
n: int = 100,
|
|
51
|
+
seed: int = 42,
|
|
52
|
+
) -> tuple[dict[str, list[float]], SpatialWeights]:
|
|
53
|
+
"""Generate synthetic spatial coordinates and autocorrelated spatial values for quick testing."""
|
|
54
|
+
import numpy as np
|
|
55
|
+
|
|
56
|
+
rng = np.random.default_rng(seed)
|
|
57
|
+
coords = rng.uniform(0.0, 100.0, size=(n, 2))
|
|
58
|
+
weights = knn_weights(coords, k=6)
|
|
59
|
+
|
|
60
|
+
# Generate spatial lag autoregressive signal
|
|
61
|
+
e = rng.normal(0, 1, size=n)
|
|
62
|
+
X1 = rng.uniform(10, 50, size=n)
|
|
63
|
+
X2 = rng.uniform(1, 5, size=n)
|
|
64
|
+
# y = 2.5 + 0.8 * W*y + 1.2 * X1 - 2.0 * X2 + e
|
|
65
|
+
I_n = np.eye(n)
|
|
66
|
+
inv_mat = np.linalg.inv(I_n - 0.65 * weights.matrix)
|
|
67
|
+
signal = 2.0 + 1.5 * X1 - 3.0 * X2 + e
|
|
68
|
+
y = np.dot(inv_mat, signal)
|
|
69
|
+
|
|
70
|
+
data = {
|
|
71
|
+
"x_coord": coords[:, 0].tolist(),
|
|
72
|
+
"y_coord": coords[:, 1].tolist(),
|
|
73
|
+
"y": y.tolist(),
|
|
74
|
+
"X1": X1.tolist(),
|
|
75
|
+
"X2": X2.tolist(),
|
|
76
|
+
}
|
|
77
|
+
return data, weights
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
__all__ = [
|
|
81
|
+
"__version__",
|
|
82
|
+
"SpatialWeights",
|
|
83
|
+
"row_standardize",
|
|
84
|
+
"knn_weights",
|
|
85
|
+
"distance_band_weights",
|
|
86
|
+
"grid_weights",
|
|
87
|
+
"GlobalMoranResult",
|
|
88
|
+
"LocalMoranResult",
|
|
89
|
+
"LocalGetisOrdResult",
|
|
90
|
+
"GearyCResult",
|
|
91
|
+
"BivariateMoranResult",
|
|
92
|
+
"SpatialGiniResult",
|
|
93
|
+
"global_moran",
|
|
94
|
+
"local_moran",
|
|
95
|
+
"local_getis_ord_gi_star",
|
|
96
|
+
"bivariate_moran",
|
|
97
|
+
"spatial_gini",
|
|
98
|
+
"GWR",
|
|
99
|
+
"MGWR",
|
|
100
|
+
"GWRResult",
|
|
101
|
+
"MGWRResult",
|
|
102
|
+
"SpatialLagResult",
|
|
103
|
+
"fit_spatial_lag",
|
|
104
|
+
"SpatialCrossValidator",
|
|
105
|
+
"SpatialCVFold",
|
|
106
|
+
"SpatialSHAP",
|
|
107
|
+
"SpatialSHAPResult",
|
|
108
|
+
"ConformalPredictor",
|
|
109
|
+
"ConformalPredictionInterval",
|
|
110
|
+
"generate_synthetic_spatial_dataset",
|
|
111
|
+
]
|