MonotoneRepairer#

class superglm.MonotoneRepairer(direction: str = 'increasing')#

Bases: object

Constrained fitted-basis projection for monotone spline curves.

repair(
spec: _SplineBase,
beta_reparam: NDArray,
groups: list[GroupSlice],
weights: NDArray | None = None,
n_grid: int = 500,
) → MonotoneRepairResult#

Project the fitted spline curve onto the requested monotone cone.

Parameters:
spec_SplineBase

The fitted spline spec (with knots, R_inv, etc. already set).

beta_reparamNDArray

Full model beta (reparametrised space). Slices for this feature are extracted via groups.

groupslist[GroupSlice]

All groups belonging to this feature (1 for non-select, 2 for select=True).

weightsNDArray or None

Grid weights (from training data histogram). If None, uniform.

n_gridint

Number of grid points for curve reconstruction.

Returns:
MonotoneRepairResult