Exact geometric model comparison via fibre-volume correction. Companion module for workspaces containing observer_geometry (nomogeo).
Project description
nomocomp
Exact geometric model comparison via fibre-volume correction.
Documentation: docs.nomogenetics.com/nomocomp
Version: 0.1.0
Requires: nomogeo >= 0.4.0, numpy, statsmodels
What it does
nomocomp replaces AIC/BIC parameter-count penalties with the actual log-determinant of the observed Fisher information — the exact fibre-volume correction in the Gaussian-fibre sector.
For nested Gaussian linear models:
- AIC uses
-2 log L + 2k - BIC uses
-2 log L + k log(n) - nomocomp uses
-2 log L + log det(I) - k log(2pi)
The third formula accounts for how tightly concentrated the posterior is in each parameter direction, not just how many parameters there are.
Install
pip install nomocomp
Flagship result
In nested Gaussian families with collinear predictors, the omitted determinant correction reverses both AIC and BIC rankings. A 56-cell collinearity phase diagram over 200 seeds shows the reversal activating continuously as correlation increases.
- At rho >= 0.9, n >= 60: exact Laplace evidence identifies the true model in 99-100% of seeds
- AIC identifies it in ~16%; BIC in ~6%
- The determinant correction is +1.5 to +3.9 nats depending on collinearity
When predictors are independent, AIC and BIC already work well and nomocomp agrees with them. The advantage appears where they fail.
Quick start
from nomocomp.extraction import extract_information
from nomocomp.comparator import GeometricModelComparator
# Extract Fisher information from fitted models
score = extract_information(ols_result, label="M1")
# Compare models with geometry
comp = GeometricModelComparator()
result = comp.compare({"M1": fit1, "M2": fit2})
print(result.geometric_ranking)
print(result.ranking_reversals)
Modules
nomocomp.extraction
Extracts the observed Fisher information matrix from fitted statsmodels results.
score = extract_information(ols_result, label="M1")
# score.geometric_score — exact Laplace score (lower = better)
# score.information_matrix — observed Fisher information at MLE
# score.log_det_information — log det(I)
# score.aic, score.bic — standard criteria for comparison
nomocomp.comparator
Compares multiple fitted models and detects ranking reversals.
result = comp.compare({"M1": fit1, "M2": fit2})
# result.geometric_ranking — models ranked by exact score
# result.ranking_reversals — where geometric disagrees with AIC/BIC
# result.branch_reversal — nomogeo branch-reversal detection
Honest boundaries
- Exact in the Gaussian-fibre sector. For non-Gaussian likelihoods, the information matrix captures local curvature only — still sharper than a parameter count, but not the exact fibre volume.
- Flat improper prior on all parameters. For nested models the prior on shared parameters cancels.
- "Exact local Laplace" means exact to quadratic order at the MLE. Not the exact marginal likelihood.
- Not yet a state-space comparator. The state-space comparison pipeline is not yet built.
Verification
python -m pytest tests/ -q # 22 tests
License
BSD-3-Clause. See LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nomocomp-0.1.0.tar.gz.
File metadata
- Download URL: nomocomp-0.1.0.tar.gz
- Upload date:
- Size: 14.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2ed060ebe7c2e6cda4f6b2c52394cd6f5c07915c65dcd7ee67cf77aa1157843b
|
|
| MD5 |
f78f9407914935086584bee9f6cdfeba
|
|
| BLAKE2b-256 |
ef3c954106df7a66043c1d6a132a3a8b409b4e12ae6fdc7007cf841e76bcf0ba
|
File details
Details for the file nomocomp-0.1.0-py3-none-any.whl.
File metadata
- Download URL: nomocomp-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
669fb277ff8e489b087b59cd5b0617f7b7b3311e27c65bfdadc59076061157f9
|
|
| MD5 |
d30d341bb7557be49680401e7fc34fc1
|
|
| BLAKE2b-256 |
923eca5dba953e008f29d1b95a02451154959c0edde9424d4ed7daf6925fb3b2
|