Skip to main content

Module response_geometry

Module response_geometry 

Source
Expand description

User-selectable response geometries beyond Sphere and Simplex.

The fit DSL exposes response_geometry="...": one scalar Gaussian GAM is fitted per tangent coordinate at a fixed base point (the intrinsic Fréchet mean when none is supplied), and predictions are mapped back to the manifold by the exponential map. Sphere and Simplex have bespoke batched wrappers in their own modules; this module supplies the same (values 2-D, base 1-D) → tangent 2-D / (tangent 2-D, base 1-D) → values 2-D contract for the curved matrix manifolds whose per-point math is already wired in [crate::geometry] but which were never reachable as a fittable response geometry: the SPD cone Sym⁺(n), the Grassmannian Gr(k, n), the Stiefel manifold St(k, n), and the Poincaré ball B^d_κ.

Every primitive here delegates to the canonical landed math (RiemannianManifold::exp_map/log_map and the Poincaré exp_map/log_map); the only new code is the batched row loop, the base-point dimension wiring, and a generic Riemannian Karcher (Fréchet) mean shared by all four. There is no separate per-manifold mean: the SPD safeguarded Karcher iteration is generalised once, over the metric supplied by RiemannianManifold::metric_tensor, so adding a curved response geometry is a single resolver arm.

Structs§

ResponseCurvatureFit
Outcome of fitting curvature as an estimand on a constant-curvature response geometry: the optimised κ̂, its tangent base point, the profile-likelihood CI, and the interior-point flatness (Wilks) test of κ = 0.

Enums§

ResponseManifold
A fittable curved response geometry. Each variant carries the shape the user requested; the embedding/ambient flat dimension is fixed by that shape and is the column count of the values matrix the caller supplies.

Functions§

dispatch_exp_map
String-driven response-geometry exponential map: inverse of dispatch_log_map given an explicit base point.
dispatch_log_map
String-driven response-geometry log map: parse the user label (with shape inference from the response column count), pick the base point (intrinsic Fréchet mean when base is None), map every row to its tangent, and report the canonical resolved label. This is the curved-manifold analogue of the sphere/simplex dispatch and the single entry the FFI calls for these geometries.
fit_response_curvature
Fit curvature as an estimand on a constant-curvature response geometry.
response_curvature_criterion
Profiled curvature criterion V_p(κ) for the constant-curvature response geometry: the σ-profiled HONEST change-of-variables negative log-likelihood of the observed chart coordinates y_i at curvature κ, expressed w.r.t. ambient Lebesgue measure dy. Lower is better (κ̂ = argmin). Returns (V_p, base); the base point is the κ-INDEPENDENT flat centroid (the tangent expansion point that the scalar GAMs are fitted around), held fixed across κ so the estimate is not re-entangled with the chart scale.
response_exp_map
Batched response-geometry exponential: map predicted tangent coordinates back to manifold-valued responses at base. Inverse of response_log_map with the same shapes.
response_frechet_mean
Intrinsic (Karcher) Fréchet mean of manifold-valued responses, the default base point when the user supplies none. values is (n_rows, ambient).
response_log_map
Batched response-geometry logarithm: map every manifold-valued response row to its tangent coordinate at base. values is (n_rows, ambient), base is (ambient,), and the returned tangent is (n_rows, ambient) (the same flat ambient layout — the tangent of a matrix manifold is itself a flattened matrix). The scalar Gaussian GAMs the caller fits operate column-wise on this matrix exactly as they do for the sphere.
response_projection_residual
Per-row extrinsic distance from ambient observations to a candidate response geometry — a coordinate-dependent constraint / closure-distance diagnostic.