smmargins.Transform

class smmargins.Transform(value: Callable[[ndarray], ndarray], grad: Callable[[ndarray], ndarray], hess: Callable[[ndarray], ndarray] | None = None, name: str = 'custom')

Analytic transformation of the linear predictor.

Parameters:
  • value (callable) – value(eta) returns the transformed scale, element-wise.

  • grad (callable) – grad(eta) returns the first derivative λ'(eta), element-wise.

  • hess (callable, optional) – hess(eta) returns the second derivative λ''(eta), element-wise. Required for dydx calls; optional for predict calls.

  • name (str, optional) – Human-readable name, used in result labels.

Notes

Custom transforms used in Margins.dydx must supply an analytic hess. Autodiff is deliberately not supported — users who want it can wrap their own Transform with jax.grad etc.

__init__(value: Callable[[ndarray], ndarray], grad: Callable[[ndarray], ndarray], hess: Callable[[ndarray], ndarray] | None = None, name: str = 'custom')

Methods

__init__(value, grad[, hess, name])