gimbal-regression 0.1.3__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.
- gimbal_regression-0.1.3/LICENSE +21 -0
- gimbal_regression-0.1.3/PKG-INFO +200 -0
- gimbal_regression-0.1.3/README.md +149 -0
- gimbal_regression-0.1.3/pyproject.toml +82 -0
- gimbal_regression-0.1.3/setup.cfg +4 -0
- gimbal_regression-0.1.3/src/gimbal_regression.egg-info/PKG-INFO +200 -0
- gimbal_regression-0.1.3/src/gimbal_regression.egg-info/SOURCES.txt +23 -0
- gimbal_regression-0.1.3/src/gimbal_regression.egg-info/dependency_links.txt +1 -0
- gimbal_regression-0.1.3/src/gimbal_regression.egg-info/requires.txt +31 -0
- gimbal_regression-0.1.3/src/gimbal_regression.egg-info/top_level.txt +1 -0
- gimbal_regression-0.1.3/src/grpy/__init__.py +10 -0
- gimbal_regression-0.1.3/src/grpy/diagnostics.py +122 -0
- gimbal_regression-0.1.3/src/grpy/model.py +446 -0
- gimbal_regression-0.1.3/src/grpy/neighbors.py +63 -0
- gimbal_regression-0.1.3/src/grpy/plotting.py +167 -0
- gimbal_regression-0.1.3/src/grpy/solver.py +126 -0
- gimbal_regression-0.1.3/src/grpy/utils.py +120 -0
- gimbal_regression-0.1.3/src/grpy/weights.py +220 -0
- gimbal_regression-0.1.3/tests/test_diagnostics.py +112 -0
- gimbal_regression-0.1.3/tests/test_model.py +110 -0
- gimbal_regression-0.1.3/tests/test_neighbors.py +70 -0
- gimbal_regression-0.1.3/tests/test_plotting.py +55 -0
- gimbal_regression-0.1.3/tests/test_solver.py +57 -0
- gimbal_regression-0.1.3/tests/test_utils.py +54 -0
- gimbal_regression-0.1.3/tests/test_weights.py +130 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Yuichiro Otani
|
|
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,200 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: gimbal-regression
|
|
3
|
+
Version: 0.1.3
|
|
4
|
+
Summary: A Python package for Gimbal Regression, a deterministic local linear regression framework with explicit diagnostics.
|
|
5
|
+
Author: Yuichiro Otani
|
|
6
|
+
License: MIT License
|
|
7
|
+
Project-URL: Homepage, https://github.com/yuichiro-otani/gimbal-regression
|
|
8
|
+
Project-URL: Repository, https://github.com/yuichiro-otani/gimbal-regression
|
|
9
|
+
Project-URL: Issues, https://github.com/yuichiro-otani/gimbal-regressionissues
|
|
10
|
+
Keywords: spatial statistics,local regression,gimbal regression,anisotropy,geographically weighted regression
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Science/Research
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Topic :: Scientific/Engineering
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: numpy>=1.24
|
|
24
|
+
Requires-Dist: pandas>=2.0
|
|
25
|
+
Requires-Dist: scikit-learn>=1.3
|
|
26
|
+
Provides-Extra: dev
|
|
27
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
28
|
+
Requires-Dist: build>=1.0; extra == "dev"
|
|
29
|
+
Requires-Dist: twine>=5.0; extra == "dev"
|
|
30
|
+
Provides-Extra: plot
|
|
31
|
+
Requires-Dist: matplotlib>=3.7; extra == "plot"
|
|
32
|
+
Requires-Dist: geopandas>=0.14; extra == "plot"
|
|
33
|
+
Requires-Dist: contextily>=1.5; extra == "plot"
|
|
34
|
+
Provides-Extra: benchmark
|
|
35
|
+
Requires-Dist: statsmodels>=0.14; extra == "benchmark"
|
|
36
|
+
Requires-Dist: mgwr>=2.1; extra == "benchmark"
|
|
37
|
+
Requires-Dist: pykrige>=1.7; extra == "benchmark"
|
|
38
|
+
Requires-Dist: pyproj>=3.6; extra == "benchmark"
|
|
39
|
+
Provides-Extra: all
|
|
40
|
+
Requires-Dist: pytest>=7.0; extra == "all"
|
|
41
|
+
Requires-Dist: build>=1.0; extra == "all"
|
|
42
|
+
Requires-Dist: twine>=5.0; extra == "all"
|
|
43
|
+
Requires-Dist: matplotlib>=3.7; extra == "all"
|
|
44
|
+
Requires-Dist: geopandas>=0.14; extra == "all"
|
|
45
|
+
Requires-Dist: contextily>=1.5; extra == "all"
|
|
46
|
+
Requires-Dist: statsmodels>=0.14; extra == "all"
|
|
47
|
+
Requires-Dist: mgwr>=2.1; extra == "all"
|
|
48
|
+
Requires-Dist: pykrige>=1.7; extra == "all"
|
|
49
|
+
Requires-Dist: pyproj>=3.6; extra == "all"
|
|
50
|
+
Dynamic: license-file
|
|
51
|
+
|
|
52
|
+
# gimbal-regression
|
|
53
|
+
|
|
54
|
+
`gimbal-regression` is a Python package for **Gimbal Regression (GR)** —
|
|
55
|
+
a deterministic local linear regression framework for **stable and reproducible estimation under anisotropic neighborhood geometry**.
|
|
56
|
+
|
|
57
|
+
The package is designed with a focus on:
|
|
58
|
+
|
|
59
|
+
- **Deterministic estimation** (no iterative optimization)
|
|
60
|
+
- **Numerical stability** under irregular spatial sampling
|
|
61
|
+
- **Explicit diagnostics** (conditioning, effective sample size, fallback)
|
|
62
|
+
- **Reproducibility** via a single-pass estimator
|
|
63
|
+
|
|
64
|
+
Unlike conventional local regression methods (e.g., GWR/MGWR), `gimbal-regression` exposes both **estimates and their numerical reliability** as first-class outputs.
|
|
65
|
+
|
|
66
|
+
The package is distributed on PyPI as `gimbal-regression` and imported in Python as `grpy`.
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## Installation
|
|
71
|
+
|
|
72
|
+
### Basic installation
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
pip install gimbal-regression
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Install from source (development mode)
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
git clone https://github.com/yuichiro-otani/gimbal-regression.git
|
|
82
|
+
cd gimbal-regression
|
|
83
|
+
pip install -e .
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Optional Dependencies
|
|
87
|
+
|
|
88
|
+
Some features require additional packages.
|
|
89
|
+
Install as needed:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
# plotting utilities
|
|
93
|
+
pip install gimbal-regression[plot]
|
|
94
|
+
|
|
95
|
+
# benchmarking and comparison methods
|
|
96
|
+
pip install gimbal-regression[benchmark]
|
|
97
|
+
|
|
98
|
+
# development tools
|
|
99
|
+
pip install gimbal-regression[dev]
|
|
100
|
+
|
|
101
|
+
# everything
|
|
102
|
+
pip install gimbal-regression[all]
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Quick Example
|
|
106
|
+
|
|
107
|
+
```python
|
|
108
|
+
import numpy as np
|
|
109
|
+
from grpy import GimbalRegression
|
|
110
|
+
|
|
111
|
+
rng = np.random.default_rng(42)
|
|
112
|
+
n = 100
|
|
113
|
+
|
|
114
|
+
lat = 35.0 + 0.02 * rng.random(n)
|
|
115
|
+
lon = 139.0 + 0.02 * rng.random(n)
|
|
116
|
+
|
|
117
|
+
x = rng.normal(size=n)
|
|
118
|
+
y = 1.0 + 2.0 * x + 0.1 * rng.normal(size=n)
|
|
119
|
+
|
|
120
|
+
model = GimbalRegression(
|
|
121
|
+
K=20,
|
|
122
|
+
h_m=2000.0,
|
|
123
|
+
gamma=1.0,
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
model.fit(
|
|
127
|
+
y=y,
|
|
128
|
+
x=x,
|
|
129
|
+
lat=lat,
|
|
130
|
+
lon=lon,
|
|
131
|
+
)
|
|
132
|
+
|
|
133
|
+
yhat = model.predict()
|
|
134
|
+
diag = model.diagnostics()
|
|
135
|
+
summary = model.summary()
|
|
136
|
+
|
|
137
|
+
print(summary)
|
|
138
|
+
```
|
|
139
|
+
## Map Visualization
|
|
140
|
+
|
|
141
|
+
Requires plot extras:
|
|
142
|
+
```bash
|
|
143
|
+
pip install gimbal-regression[plot]
|
|
144
|
+
```
|
|
145
|
+
Example:
|
|
146
|
+
```python
|
|
147
|
+
fig, ax = model.draw_map(
|
|
148
|
+
column="B1",
|
|
149
|
+
title="Local coefficient B1",
|
|
150
|
+
basemap=True,
|
|
151
|
+
)
|
|
152
|
+
```
|
|
153
|
+
## Diagnostics
|
|
154
|
+
`grpy` returns diagnostic quantities alongside estimates:
|
|
155
|
+
- Condition numbers of local normal matrices
|
|
156
|
+
- Effective sample size (ESS)
|
|
157
|
+
- Fallback indicators (uniform weighting)
|
|
158
|
+
|
|
159
|
+
```python
|
|
160
|
+
diag = model.diagnostics()
|
|
161
|
+
print(diag.head())
|
|
162
|
+
```
|
|
163
|
+
These diagnostics allow users to directly assess numerical reliability of local estimates, not just predictive accuracy.
|
|
164
|
+
|
|
165
|
+
## Reproducibility
|
|
166
|
+
|
|
167
|
+
The estimator is:
|
|
168
|
+
- deterministic
|
|
169
|
+
- single-pass
|
|
170
|
+
- free from stochastic components
|
|
171
|
+
|
|
172
|
+
This ensures that results are exactly reproducible given identical inputs.
|
|
173
|
+
|
|
174
|
+
## Project Structure
|
|
175
|
+
```
|
|
176
|
+
gimbal-regression/
|
|
177
|
+
├── src/grpy/
|
|
178
|
+
├── tests/
|
|
179
|
+
├── examples/
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
- `src/grpy` – core implementation
|
|
183
|
+
- `tests/` – unit tests
|
|
184
|
+
- `examples/` – usage examples
|
|
185
|
+
|
|
186
|
+
## Citation
|
|
187
|
+
|
|
188
|
+
If you use this package, please cite:
|
|
189
|
+
```bibtex
|
|
190
|
+
@article{Otani2026GR,
|
|
191
|
+
author = {Otani, Yuichiro},
|
|
192
|
+
title = {Gimbal Regression: A Geometry-Aware Framework for Stable Local Linear Estimation under Anisotropic Sampling},
|
|
193
|
+
journal = {arXiv preprint arXiv:2603.10382},
|
|
194
|
+
year = {2026},
|
|
195
|
+
doi = {10.48550/arXiv.2603.10382}
|
|
196
|
+
}
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
## License
|
|
200
|
+
MIT License
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# gimbal-regression
|
|
2
|
+
|
|
3
|
+
`gimbal-regression` is a Python package for **Gimbal Regression (GR)** —
|
|
4
|
+
a deterministic local linear regression framework for **stable and reproducible estimation under anisotropic neighborhood geometry**.
|
|
5
|
+
|
|
6
|
+
The package is designed with a focus on:
|
|
7
|
+
|
|
8
|
+
- **Deterministic estimation** (no iterative optimization)
|
|
9
|
+
- **Numerical stability** under irregular spatial sampling
|
|
10
|
+
- **Explicit diagnostics** (conditioning, effective sample size, fallback)
|
|
11
|
+
- **Reproducibility** via a single-pass estimator
|
|
12
|
+
|
|
13
|
+
Unlike conventional local regression methods (e.g., GWR/MGWR), `gimbal-regression` exposes both **estimates and their numerical reliability** as first-class outputs.
|
|
14
|
+
|
|
15
|
+
The package is distributed on PyPI as `gimbal-regression` and imported in Python as `grpy`.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
### Basic installation
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pip install gimbal-regression
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Install from source (development mode)
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
git clone https://github.com/yuichiro-otani/gimbal-regression.git
|
|
31
|
+
cd gimbal-regression
|
|
32
|
+
pip install -e .
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Optional Dependencies
|
|
36
|
+
|
|
37
|
+
Some features require additional packages.
|
|
38
|
+
Install as needed:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
# plotting utilities
|
|
42
|
+
pip install gimbal-regression[plot]
|
|
43
|
+
|
|
44
|
+
# benchmarking and comparison methods
|
|
45
|
+
pip install gimbal-regression[benchmark]
|
|
46
|
+
|
|
47
|
+
# development tools
|
|
48
|
+
pip install gimbal-regression[dev]
|
|
49
|
+
|
|
50
|
+
# everything
|
|
51
|
+
pip install gimbal-regression[all]
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Quick Example
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
import numpy as np
|
|
58
|
+
from grpy import GimbalRegression
|
|
59
|
+
|
|
60
|
+
rng = np.random.default_rng(42)
|
|
61
|
+
n = 100
|
|
62
|
+
|
|
63
|
+
lat = 35.0 + 0.02 * rng.random(n)
|
|
64
|
+
lon = 139.0 + 0.02 * rng.random(n)
|
|
65
|
+
|
|
66
|
+
x = rng.normal(size=n)
|
|
67
|
+
y = 1.0 + 2.0 * x + 0.1 * rng.normal(size=n)
|
|
68
|
+
|
|
69
|
+
model = GimbalRegression(
|
|
70
|
+
K=20,
|
|
71
|
+
h_m=2000.0,
|
|
72
|
+
gamma=1.0,
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
model.fit(
|
|
76
|
+
y=y,
|
|
77
|
+
x=x,
|
|
78
|
+
lat=lat,
|
|
79
|
+
lon=lon,
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
yhat = model.predict()
|
|
83
|
+
diag = model.diagnostics()
|
|
84
|
+
summary = model.summary()
|
|
85
|
+
|
|
86
|
+
print(summary)
|
|
87
|
+
```
|
|
88
|
+
## Map Visualization
|
|
89
|
+
|
|
90
|
+
Requires plot extras:
|
|
91
|
+
```bash
|
|
92
|
+
pip install gimbal-regression[plot]
|
|
93
|
+
```
|
|
94
|
+
Example:
|
|
95
|
+
```python
|
|
96
|
+
fig, ax = model.draw_map(
|
|
97
|
+
column="B1",
|
|
98
|
+
title="Local coefficient B1",
|
|
99
|
+
basemap=True,
|
|
100
|
+
)
|
|
101
|
+
```
|
|
102
|
+
## Diagnostics
|
|
103
|
+
`grpy` returns diagnostic quantities alongside estimates:
|
|
104
|
+
- Condition numbers of local normal matrices
|
|
105
|
+
- Effective sample size (ESS)
|
|
106
|
+
- Fallback indicators (uniform weighting)
|
|
107
|
+
|
|
108
|
+
```python
|
|
109
|
+
diag = model.diagnostics()
|
|
110
|
+
print(diag.head())
|
|
111
|
+
```
|
|
112
|
+
These diagnostics allow users to directly assess numerical reliability of local estimates, not just predictive accuracy.
|
|
113
|
+
|
|
114
|
+
## Reproducibility
|
|
115
|
+
|
|
116
|
+
The estimator is:
|
|
117
|
+
- deterministic
|
|
118
|
+
- single-pass
|
|
119
|
+
- free from stochastic components
|
|
120
|
+
|
|
121
|
+
This ensures that results are exactly reproducible given identical inputs.
|
|
122
|
+
|
|
123
|
+
## Project Structure
|
|
124
|
+
```
|
|
125
|
+
gimbal-regression/
|
|
126
|
+
├── src/grpy/
|
|
127
|
+
├── tests/
|
|
128
|
+
├── examples/
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
- `src/grpy` – core implementation
|
|
132
|
+
- `tests/` – unit tests
|
|
133
|
+
- `examples/` – usage examples
|
|
134
|
+
|
|
135
|
+
## Citation
|
|
136
|
+
|
|
137
|
+
If you use this package, please cite:
|
|
138
|
+
```bibtex
|
|
139
|
+
@article{Otani2026GR,
|
|
140
|
+
author = {Otani, Yuichiro},
|
|
141
|
+
title = {Gimbal Regression: A Geometry-Aware Framework for Stable Local Linear Estimation under Anisotropic Sampling},
|
|
142
|
+
journal = {arXiv preprint arXiv:2603.10382},
|
|
143
|
+
year = {2026},
|
|
144
|
+
doi = {10.48550/arXiv.2603.10382}
|
|
145
|
+
}
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## License
|
|
149
|
+
MIT License
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "gimbal-regression"
|
|
7
|
+
version = "0.1.3"
|
|
8
|
+
description = "A Python package for Gimbal Regression, a deterministic local linear regression framework with explicit diagnostics."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = { text = "MIT License" }
|
|
11
|
+
authors = [
|
|
12
|
+
{ name = "Yuichiro Otani" }
|
|
13
|
+
]
|
|
14
|
+
requires-python = ">=3.10"
|
|
15
|
+
dependencies = [
|
|
16
|
+
"numpy>=1.24",
|
|
17
|
+
"pandas>=2.0",
|
|
18
|
+
"scikit-learn>=1.3"
|
|
19
|
+
]
|
|
20
|
+
keywords = [
|
|
21
|
+
"spatial statistics",
|
|
22
|
+
"local regression",
|
|
23
|
+
"gimbal regression",
|
|
24
|
+
"anisotropy",
|
|
25
|
+
"geographically weighted regression"
|
|
26
|
+
]
|
|
27
|
+
classifiers = [
|
|
28
|
+
"Development Status :: 3 - Alpha",
|
|
29
|
+
"Intended Audience :: Science/Research",
|
|
30
|
+
"License :: OSI Approved :: MIT License",
|
|
31
|
+
"Programming Language :: Python :: 3",
|
|
32
|
+
"Programming Language :: Python :: 3.10",
|
|
33
|
+
"Programming Language :: Python :: 3.11",
|
|
34
|
+
"Programming Language :: Python :: 3.12",
|
|
35
|
+
"Topic :: Scientific/Engineering",
|
|
36
|
+
"Topic :: Scientific/Engineering :: Mathematics"
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
[project.optional-dependencies]
|
|
40
|
+
dev = [
|
|
41
|
+
"pytest>=7.0",
|
|
42
|
+
"build>=1.0",
|
|
43
|
+
"twine>=5.0"
|
|
44
|
+
]
|
|
45
|
+
plot = [
|
|
46
|
+
"matplotlib>=3.7",
|
|
47
|
+
"geopandas>=0.14",
|
|
48
|
+
"contextily>=1.5"
|
|
49
|
+
]
|
|
50
|
+
benchmark = [
|
|
51
|
+
"statsmodels>=0.14",
|
|
52
|
+
"mgwr>=2.1",
|
|
53
|
+
"pykrige>=1.7",
|
|
54
|
+
"pyproj>=3.6"
|
|
55
|
+
]
|
|
56
|
+
all = [
|
|
57
|
+
"pytest>=7.0",
|
|
58
|
+
"build>=1.0",
|
|
59
|
+
"twine>=5.0",
|
|
60
|
+
"matplotlib>=3.7",
|
|
61
|
+
"geopandas>=0.14",
|
|
62
|
+
"contextily>=1.5",
|
|
63
|
+
"statsmodels>=0.14",
|
|
64
|
+
"mgwr>=2.1",
|
|
65
|
+
"pykrige>=1.7",
|
|
66
|
+
"pyproj>=3.6"
|
|
67
|
+
]
|
|
68
|
+
|
|
69
|
+
[project.urls]
|
|
70
|
+
Homepage = "https://github.com/yuichiro-otani/gimbal-regression"
|
|
71
|
+
Repository = "https://github.com/yuichiro-otani/gimbal-regression"
|
|
72
|
+
Issues = "https://github.com/yuichiro-otani/gimbal-regressionissues"
|
|
73
|
+
|
|
74
|
+
[tool.setuptools]
|
|
75
|
+
package-dir = {"" = "src"}
|
|
76
|
+
|
|
77
|
+
[tool.setuptools.packages.find]
|
|
78
|
+
where = ["src"]
|
|
79
|
+
|
|
80
|
+
[tool.pytest.ini_options]
|
|
81
|
+
testpaths = ["tests"]
|
|
82
|
+
pythonpath = ["src"]
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: gimbal-regression
|
|
3
|
+
Version: 0.1.3
|
|
4
|
+
Summary: A Python package for Gimbal Regression, a deterministic local linear regression framework with explicit diagnostics.
|
|
5
|
+
Author: Yuichiro Otani
|
|
6
|
+
License: MIT License
|
|
7
|
+
Project-URL: Homepage, https://github.com/yuichiro-otani/gimbal-regression
|
|
8
|
+
Project-URL: Repository, https://github.com/yuichiro-otani/gimbal-regression
|
|
9
|
+
Project-URL: Issues, https://github.com/yuichiro-otani/gimbal-regressionissues
|
|
10
|
+
Keywords: spatial statistics,local regression,gimbal regression,anisotropy,geographically weighted regression
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Science/Research
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Topic :: Scientific/Engineering
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: numpy>=1.24
|
|
24
|
+
Requires-Dist: pandas>=2.0
|
|
25
|
+
Requires-Dist: scikit-learn>=1.3
|
|
26
|
+
Provides-Extra: dev
|
|
27
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
28
|
+
Requires-Dist: build>=1.0; extra == "dev"
|
|
29
|
+
Requires-Dist: twine>=5.0; extra == "dev"
|
|
30
|
+
Provides-Extra: plot
|
|
31
|
+
Requires-Dist: matplotlib>=3.7; extra == "plot"
|
|
32
|
+
Requires-Dist: geopandas>=0.14; extra == "plot"
|
|
33
|
+
Requires-Dist: contextily>=1.5; extra == "plot"
|
|
34
|
+
Provides-Extra: benchmark
|
|
35
|
+
Requires-Dist: statsmodels>=0.14; extra == "benchmark"
|
|
36
|
+
Requires-Dist: mgwr>=2.1; extra == "benchmark"
|
|
37
|
+
Requires-Dist: pykrige>=1.7; extra == "benchmark"
|
|
38
|
+
Requires-Dist: pyproj>=3.6; extra == "benchmark"
|
|
39
|
+
Provides-Extra: all
|
|
40
|
+
Requires-Dist: pytest>=7.0; extra == "all"
|
|
41
|
+
Requires-Dist: build>=1.0; extra == "all"
|
|
42
|
+
Requires-Dist: twine>=5.0; extra == "all"
|
|
43
|
+
Requires-Dist: matplotlib>=3.7; extra == "all"
|
|
44
|
+
Requires-Dist: geopandas>=0.14; extra == "all"
|
|
45
|
+
Requires-Dist: contextily>=1.5; extra == "all"
|
|
46
|
+
Requires-Dist: statsmodels>=0.14; extra == "all"
|
|
47
|
+
Requires-Dist: mgwr>=2.1; extra == "all"
|
|
48
|
+
Requires-Dist: pykrige>=1.7; extra == "all"
|
|
49
|
+
Requires-Dist: pyproj>=3.6; extra == "all"
|
|
50
|
+
Dynamic: license-file
|
|
51
|
+
|
|
52
|
+
# gimbal-regression
|
|
53
|
+
|
|
54
|
+
`gimbal-regression` is a Python package for **Gimbal Regression (GR)** —
|
|
55
|
+
a deterministic local linear regression framework for **stable and reproducible estimation under anisotropic neighborhood geometry**.
|
|
56
|
+
|
|
57
|
+
The package is designed with a focus on:
|
|
58
|
+
|
|
59
|
+
- **Deterministic estimation** (no iterative optimization)
|
|
60
|
+
- **Numerical stability** under irregular spatial sampling
|
|
61
|
+
- **Explicit diagnostics** (conditioning, effective sample size, fallback)
|
|
62
|
+
- **Reproducibility** via a single-pass estimator
|
|
63
|
+
|
|
64
|
+
Unlike conventional local regression methods (e.g., GWR/MGWR), `gimbal-regression` exposes both **estimates and their numerical reliability** as first-class outputs.
|
|
65
|
+
|
|
66
|
+
The package is distributed on PyPI as `gimbal-regression` and imported in Python as `grpy`.
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## Installation
|
|
71
|
+
|
|
72
|
+
### Basic installation
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
pip install gimbal-regression
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Install from source (development mode)
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
git clone https://github.com/yuichiro-otani/gimbal-regression.git
|
|
82
|
+
cd gimbal-regression
|
|
83
|
+
pip install -e .
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Optional Dependencies
|
|
87
|
+
|
|
88
|
+
Some features require additional packages.
|
|
89
|
+
Install as needed:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
# plotting utilities
|
|
93
|
+
pip install gimbal-regression[plot]
|
|
94
|
+
|
|
95
|
+
# benchmarking and comparison methods
|
|
96
|
+
pip install gimbal-regression[benchmark]
|
|
97
|
+
|
|
98
|
+
# development tools
|
|
99
|
+
pip install gimbal-regression[dev]
|
|
100
|
+
|
|
101
|
+
# everything
|
|
102
|
+
pip install gimbal-regression[all]
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Quick Example
|
|
106
|
+
|
|
107
|
+
```python
|
|
108
|
+
import numpy as np
|
|
109
|
+
from grpy import GimbalRegression
|
|
110
|
+
|
|
111
|
+
rng = np.random.default_rng(42)
|
|
112
|
+
n = 100
|
|
113
|
+
|
|
114
|
+
lat = 35.0 + 0.02 * rng.random(n)
|
|
115
|
+
lon = 139.0 + 0.02 * rng.random(n)
|
|
116
|
+
|
|
117
|
+
x = rng.normal(size=n)
|
|
118
|
+
y = 1.0 + 2.0 * x + 0.1 * rng.normal(size=n)
|
|
119
|
+
|
|
120
|
+
model = GimbalRegression(
|
|
121
|
+
K=20,
|
|
122
|
+
h_m=2000.0,
|
|
123
|
+
gamma=1.0,
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
model.fit(
|
|
127
|
+
y=y,
|
|
128
|
+
x=x,
|
|
129
|
+
lat=lat,
|
|
130
|
+
lon=lon,
|
|
131
|
+
)
|
|
132
|
+
|
|
133
|
+
yhat = model.predict()
|
|
134
|
+
diag = model.diagnostics()
|
|
135
|
+
summary = model.summary()
|
|
136
|
+
|
|
137
|
+
print(summary)
|
|
138
|
+
```
|
|
139
|
+
## Map Visualization
|
|
140
|
+
|
|
141
|
+
Requires plot extras:
|
|
142
|
+
```bash
|
|
143
|
+
pip install gimbal-regression[plot]
|
|
144
|
+
```
|
|
145
|
+
Example:
|
|
146
|
+
```python
|
|
147
|
+
fig, ax = model.draw_map(
|
|
148
|
+
column="B1",
|
|
149
|
+
title="Local coefficient B1",
|
|
150
|
+
basemap=True,
|
|
151
|
+
)
|
|
152
|
+
```
|
|
153
|
+
## Diagnostics
|
|
154
|
+
`grpy` returns diagnostic quantities alongside estimates:
|
|
155
|
+
- Condition numbers of local normal matrices
|
|
156
|
+
- Effective sample size (ESS)
|
|
157
|
+
- Fallback indicators (uniform weighting)
|
|
158
|
+
|
|
159
|
+
```python
|
|
160
|
+
diag = model.diagnostics()
|
|
161
|
+
print(diag.head())
|
|
162
|
+
```
|
|
163
|
+
These diagnostics allow users to directly assess numerical reliability of local estimates, not just predictive accuracy.
|
|
164
|
+
|
|
165
|
+
## Reproducibility
|
|
166
|
+
|
|
167
|
+
The estimator is:
|
|
168
|
+
- deterministic
|
|
169
|
+
- single-pass
|
|
170
|
+
- free from stochastic components
|
|
171
|
+
|
|
172
|
+
This ensures that results are exactly reproducible given identical inputs.
|
|
173
|
+
|
|
174
|
+
## Project Structure
|
|
175
|
+
```
|
|
176
|
+
gimbal-regression/
|
|
177
|
+
├── src/grpy/
|
|
178
|
+
├── tests/
|
|
179
|
+
├── examples/
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
- `src/grpy` – core implementation
|
|
183
|
+
- `tests/` – unit tests
|
|
184
|
+
- `examples/` – usage examples
|
|
185
|
+
|
|
186
|
+
## Citation
|
|
187
|
+
|
|
188
|
+
If you use this package, please cite:
|
|
189
|
+
```bibtex
|
|
190
|
+
@article{Otani2026GR,
|
|
191
|
+
author = {Otani, Yuichiro},
|
|
192
|
+
title = {Gimbal Regression: A Geometry-Aware Framework for Stable Local Linear Estimation under Anisotropic Sampling},
|
|
193
|
+
journal = {arXiv preprint arXiv:2603.10382},
|
|
194
|
+
year = {2026},
|
|
195
|
+
doi = {10.48550/arXiv.2603.10382}
|
|
196
|
+
}
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
## License
|
|
200
|
+
MIT License
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
src/gimbal_regression.egg-info/PKG-INFO
|
|
5
|
+
src/gimbal_regression.egg-info/SOURCES.txt
|
|
6
|
+
src/gimbal_regression.egg-info/dependency_links.txt
|
|
7
|
+
src/gimbal_regression.egg-info/requires.txt
|
|
8
|
+
src/gimbal_regression.egg-info/top_level.txt
|
|
9
|
+
src/grpy/__init__.py
|
|
10
|
+
src/grpy/diagnostics.py
|
|
11
|
+
src/grpy/model.py
|
|
12
|
+
src/grpy/neighbors.py
|
|
13
|
+
src/grpy/plotting.py
|
|
14
|
+
src/grpy/solver.py
|
|
15
|
+
src/grpy/utils.py
|
|
16
|
+
src/grpy/weights.py
|
|
17
|
+
tests/test_diagnostics.py
|
|
18
|
+
tests/test_model.py
|
|
19
|
+
tests/test_neighbors.py
|
|
20
|
+
tests/test_plotting.py
|
|
21
|
+
tests/test_solver.py
|
|
22
|
+
tests/test_utils.py
|
|
23
|
+
tests/test_weights.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|