Skip to main content

A Python package for Gimbal Regression, a deterministic local linear regression framework with explicit diagnostics.

Project description

gimbal-regression

gimbal-regression is a Python package for Gimbal Regression (GR)
a deterministic local linear regression framework for stable and reproducible estimation under anisotropic neighborhood geometry.

The package is designed with a focus on:

  • Deterministic estimation (no iterative optimization)
  • Numerical stability under irregular spatial sampling
  • Explicit diagnostics (conditioning, effective sample size, fallback)
  • Reproducibility via a single-pass estimator

Unlike conventional local regression methods (e.g., GWR/MGWR), gimbal-regression exposes both estimates and their numerical reliability as first-class outputs.

The package is distributed on PyPI as gimbal-regression and imported in Python as grpy.


Installation

Basic installation

pip install gimbal-regression

Install from source (development mode)

git clone https://github.com/yuichiro-otani/gimbal-regression.git
cd gimbal-regression
pip install -e .

Optional Dependencies

Some features require additional packages. Install as needed:

# plotting utilities
pip install gimbal-regression[plot]

# benchmarking and comparison methods
pip install gimbal-regression[benchmark]

# development tools
pip install gimbal-regression[dev]

# everything
pip install gimbal-regression[all]

Quick Example

import numpy as np
from grpy import GimbalRegression

rng = np.random.default_rng(42)
n = 100

lat = 35.0 + 0.02 * rng.random(n)
lon = 139.0 + 0.02 * rng.random(n)

x = rng.normal(size=n)
y = 1.0 + 2.0 * x + 0.1 * rng.normal(size=n)

model = GimbalRegression(
    K=20,
    h_m=2000.0,
    gamma=1.0,
)

model.fit(
    y=y,
    x=x,
    lat=lat,
    lon=lon,
)

yhat = model.predict()
diag = model.diagnostics()
summary = model.summary()

print(summary)

Map Visualization

Requires plot extras:

pip install gimbal-regression[plot]

Example:

fig, ax = model.draw_map(
    column="B1",
    title="Local coefficient B1",
    basemap=True,
)

Diagnostics

grpy returns diagnostic quantities alongside estimates:

  • Condition numbers of local normal matrices
  • Effective sample size (ESS)
  • Fallback indicators (uniform weighting)
diag = model.diagnostics()
print(diag.head())

These diagnostics allow users to directly assess numerical reliability of local estimates, not just predictive accuracy.

Reproducibility

The estimator is:

  • deterministic
  • single-pass
  • free from stochastic components

This ensures that results are exactly reproducible given identical inputs.

Project Structure

gimbal-regression/
├── src/grpy/
├── tests/
├── examples/
  • src/grpy – core implementation
  • tests/ – unit tests
  • examples/ – usage examples

Citation

If you use this package, please cite:

@article{Otani2026GR,
  author  = {Otani, Yuichiro},
  title   = {Gimbal Regression: A Geometry-Aware Framework for Stable Local Linear Estimation under Anisotropic Sampling},
  journal = {arXiv preprint arXiv:2603.10382},
  year    = {2026},
  doi     = {10.48550/arXiv.2603.10382}
}

License

MIT License

Project details


Download files

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

Source Distribution

gimbal_regression-0.1.3.tar.gz (17.9 kB view details)

Uploaded Source

Built Distribution

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

gimbal_regression-0.1.3-py3-none-any.whl (16.7 kB view details)

Uploaded Python 3

File details

Details for the file gimbal_regression-0.1.3.tar.gz.

File metadata

  • Download URL: gimbal_regression-0.1.3.tar.gz
  • Upload date:
  • Size: 17.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for gimbal_regression-0.1.3.tar.gz
Algorithm Hash digest
SHA256 dcdc42813ec1d184b1e86a6dddf48f49e37642dd646b9abe7943e26dc4780b60
MD5 1168811d72f8a668aae439ff7d2d1f51
BLAKE2b-256 338fe315382c811275ef0653e640a75679e6c442317500e4e66e639d97e94f8a

See more details on using hashes here.

File details

Details for the file gimbal_regression-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for gimbal_regression-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 5b8532d1b2c61a67e96fe615194740b9f333a1130073f1f82161c915ebbd3f7d
MD5 52563184f0bd772811a490fc62e3e5c4
BLAKE2b-256 a748f974b50215043385205b55cb60dea3ba982c287883b1e31ca0990d14f741

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page