!!! warning
THIS PROJECT IS STILL IN ALPHA AND SUBJEC TO CHANGE DRAMATICALLY; USE AT YOUR OWN RISK**
glmax provides generalized linear modeling with a grammar-first API built
around explicit nouns and top-level verbs.
The canonical workflow is:
specify(...) -> GLMfit(model, data, init=None, *, fitter=...) -> FittedGLMpredict(model, params, data)for fitted meansinfer(fitted, inferrer=None, stderr=...)for inferential summaries without refittingcheck(fitted)for diagnostics without refitting
The canonical nouns are GLMData, Params, FitResult, FittedGLM, InferenceResult, AbstractDiagnostic, GofStats, and InfluenceStats.
The package-root also exports inference strategy and stderr types:
AbstractTest, WaldTest, ScoreTest,
AbstractStdErrEstimator, FisherInfoError, and HuberError.
Params(beta, disp, aux) is the shared parameter carrier across fit,
predict, and infer:
betastores regression coefficients.dispstores GLM dispersion. Gaussian and Gamma use it as EDM dispersion; Poisson, Binomial, and Negative Binomial canonicalize it to1.0.auxstores optional family-specific state. Negative Binomial stores itsalphahere while canonicaldispremains1.0.
See docs/index.md for the workflow overview, the
specify API for model construction, and the
Families & Links guide for the
family-specific disp/aux split.
git clone https://github.com/mancusolab/glmax.git
cd glmax
pip install .import jax.numpy as jnp
import glmax
from glmax import GLMData
from glmax.family import Gaussian
model = glmax.specify(family=Gaussian())
data = GLMData(
X=jnp.array([[0.0], [1.0], [2.0], [3.0]]),
y=jnp.array([0.1, 1.2, 1.9, 3.1]),
)
fitted = glmax.fit(model, data)
params = fitted.params
pred = glmax.predict(model, params, data)
infer_result = glmax.infer(fitted)
# Route through an explicit inferrer when needed.
score_result = glmax.infer(fitted, inferrer=glmax.ScoreTest())
pearson = glmax.check(fitted)Use the repository-standard pytest invocation (also wired into project scripts):
pytest -p no:capture testsglmax is distributed under the MIT license.