Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Interpretml Interpret GammaDevianceRegressionObjective

From Leeroopedia
Revision as of 15:16, 16 February 2026 by Admin (talk | contribs) (Auto-imported from implementations/Interpretml_Interpret_GammaDevianceRegressionObjective.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


Knowledge Sources
Domains Machine_Learning, EBM_Core
Last Updated 2026-02-07 12:00 GMT

Overview

Implements the Gamma deviance regression objective function for modeling positive-valued continuous targets with the log link function.

Description

The GammaDevianceRegressionObjective.hpp defines the GammaDevianceRegressionObjective struct, which implements the Gamma distribution deviance loss for regression on strictly positive targets. It uses the log link function, meaning the prediction is exp(score). The metric is computed as target/prediction - 1 - log(target/prediction), which is the unit Gamma deviance. FinishMetric multiplies by 2.0 to get the standard deviance scale. The gradient is 1 - target * exp(-score) and the hessian is target * exp(-score). The objective requires positive targets (rejects NaN, infinity, and values <= 0). It does not support differential privacy. Exp<true>(score) is used throughout, which computes exp(-score) directly to avoid a separate negation.

Usage

Used when the user specifies the "gamma_deviance" objective for modeling positive-valued targets that follow a Gamma distribution, such as insurance claim amounts or waiting times.

Code Reference

Source Location

  • Repository: Interpretml_Interpret
  • File: shared/libebm/compute/objectives/GammaDevianceRegressionObjective.hpp

Signature

template<typename TFloat> struct GammaDevianceRegressionObjective : RegressionObjective {
   OBJECTIVE_BOILERPLATE(GammaDevianceRegressionObjective, MINIMIZE_METRIC,
       Objective_Other, Link_log, true)

   inline GammaDevianceRegressionObjective(const Config& config);
   inline bool CheckRegressionTarget(const double target) const noexcept;
   inline double FinishMetric(const double metricSum) const noexcept;  // returns 2.0 * metricSum

   GPU_DEVICE inline TFloat CalcMetric(const TFloat& score, const TFloat& target) const noexcept;
   GPU_DEVICE inline TFloat CalcGradient(const TFloat& score, const TFloat& target) const noexcept;
   GPU_DEVICE inline GradientHessian<TFloat> CalcGradientHessian(
       const TFloat& score, const TFloat& target) const noexcept;
};

I/O Contract

Method Formula
CalcMetric target * exp(-score) - 1 - log(target * exp(-score))
CalcGradient 1 - target * exp(-score)
CalcGradientHessian gradient = 1 - target/prediction; hessian = target/prediction

Usage Examples

# Called internally via native bindings
from interpret.glassbox import ExplainableBoostingRegressor
ebm = ExplainableBoostingRegressor(objective="gamma_deviance")
ebm.fit(X, y)  # Uses GammaDevianceRegressionObjective for positive targets

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment