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 BinSumsInteraction

From Leeroopedia


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

Overview

Implements the histogram bin summation logic for EBM interaction detection, accumulating multi-dimensional gradient and hessian statistics.

Description

The BinSumsInteraction.hpp header contains the BinSumsInteractionInternal function, which builds multi-dimensional histograms for interaction detection. Unlike the boosting variant, this function handles multiple feature dimensions simultaneously, computing a combined bin index from bit-packed feature values across all dimensions. It uses a stack-allocated DimensionalData array to track per-dimension state including bit shifts, masks, and bin counts. The function processes samples in SIMD-width chunks (determined by TFloat::k_cSIMDPack), accumulating gradients, hessians, sample counts, and weights into multi-dimensional bins. The combined bin index is computed by multiplying individual dimension indices by their respective strides.

Usage

Called during interaction detection to build multi-dimensional histograms. These histograms enable the calculation of interaction strength between pairs or groups of features, which determines which feature interactions to include in the EBM model.

Code Reference

Source Location

Signature

template<typename TFloat, bool bHessian, bool bWeight, size_t cCompilerScores, size_t cCompilerDimensions>
GPU_DEVICE NEVER_INLINE static void BinSumsInteractionInternal(
    BinSumsInteractionBridge* const pParams);

struct DimensionalData {
   int m_cShift;
   int m_cBitsPerItemMax;
   int m_cShiftReset;
   const typename TFloat::TInt::T* m_pData;
   size_t m_cBins;
   typename TFloat::TInt iBinCombined;
   typename TFloat::TInt maskBits;
};

I/O Contract

Input (via BinSumsInteractionBridge) Description
m_cSamples Number of samples to process
m_aGradientsAndHessians Per-sample gradient/hessian values
m_aWeights Per-sample weights (optional)
m_aaPacked Bit-packed feature data per dimension
m_acItemsPerBitPack Items per bit pack per dimension
m_cRuntimeRealDimensions Number of feature dimensions
m_aFastBins Output multi-dimensional bin array
Output Description
m_aFastBins Multi-dimensional bins with accumulated gradient/hessian statistics

Usage Examples

# Called internally via native bindings
from interpret.glassbox import ExplainableBoostingClassifier
ebm = ExplainableBoostingClassifier(interactions=10)
ebm.fit(X, y)  # BinSumsInteraction runs during interaction detection

Related Pages

Page Connections

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