kumulant

Link

@Serializable(with = LinkSerializer::class)
sealed interface Link(source)

Canonical GLM link functions used by the online regression models.

invMean maps a linear predictor to the response mean. curvature gives the negative log-likelihood curvature used to update precision. loss supplies the fit error accumulated by the model: squared error for Identity, negative log-likelihood without response-only constants for Logit and Log.

Only canonical links are exposed so the gradient can use (mu - y) * x.

Inheritors

Types

Link copied to clipboard
@Serializable
@SerialName(value = "Identity")
data object Identity : Link

Gaussian response with unit variance: mean eta, curvature 1, loss (eta - y)^2. The loss is twice the negative log-likelihood so regression results retain squared-error units.

Link copied to clipboard
@Serializable
@SerialName(value = "Log")
data object Log : Link

Poisson response: mean and curvature exp(eta), loss exp(eta) - y * eta. Expects non-negative targets; omits the response-only log(y!) term.

Link copied to clipboard
@Serializable
@SerialName(value = "Logit")
data object Logit : Link

Bernoulli response: mean sigmoid(eta), curvature mu * (1 - mu), loss softplus(eta) - y * eta. Expects binary targets.

Functions

curvature

abstract fun curvature(eta: Double): Double(source)

Second derivative of the per-observation negative log-likelihood at eta.

invMean

abstract fun invMean(eta: Double): Double(source)

Inverse link: maps the linear predictor eta to the response mean.

loss

abstract fun loss(eta: Double, y: Double): Double(source)

Per-observation fit error: squared error for Identity, negative log-likelihood up to response-only constants for Logit and Log.