Implementation:Interpretml Interpret Bridge
| Knowledge Sources | |
|---|---|
| Domains | Machine_Learning, EBM_Core |
| Last Updated | 2026-02-07 12:00 GMT |
Overview
Defines the C-compatible bridge structures (ApplyUpdateBridge, BinSumsBoostingBridge, BinSumsInteractionBridge) that pass data between the main EBM code and the compute-zone SIMD implementations.
Description
The bridge.h header is a C-compatible header (using extern "C") that defines the fundamental data types and bridge structures used to communicate between the zone-agnostic main EBM code and the zone-specific compute implementations (CPU, AVX2, AVX-512). It defines type aliases for the big/small float and unsigned integer types (FloatBig=double, FloatSmall=float, UIntBig=uint64_t, UIntSmall=uint32_t). The three main bridge structures are: ApplyUpdateBridge (for passing score update data including targets, weights, sample scores, gradients/hessians), BinSumsBoostingBridge (for passing boosting histogram parameters including packed features and bin storage), and BinSumsInteractionBridge (for passing interaction histogram parameters with multi-dimensional packed features). The header also defines constants for parallel binning thresholds (HESSIAN_PARALLEL_BIN_BYTES_MAX, etc.).
Usage
These bridge structures are populated by the main zone code and passed to the compute-zone function pointers stored in the ObjectiveWrapper. This allows the same data to be processed by different SIMD implementations without the main code needing to know the specific compute zone.
Code Reference
Source Location
- Repository: Interpretml_Interpret
- File: shared/libebm/bridge/bridge.h
Signature
typedef double FloatShared;
typedef uint64_t UIntBig;
typedef double FloatBig;
typedef uint32_t UIntSmall;
typedef float FloatSmall;
struct ApplyUpdateBridge {
size_t m_cScores;
int m_cPack;
BoolEbm m_bHessianNeeded;
BoolEbm m_bValidation;
BoolEbm m_bUseApprox;
void* m_aMulticlassMidwayTemp;
const void* m_aUpdateTensorScores;
size_t m_cSamples;
const void* m_aPacked;
const void* m_aTargets;
const void* m_aWeights;
void* m_aSampleScores;
void* m_aGradientsAndHessians;
double m_metricOut;
};
struct BinSumsBoostingBridge {
BoolEbm m_bParallelBins;
BoolEbm m_bHessian;
size_t m_cScores;
int m_cPack;
size_t m_cSamples;
size_t m_cBytesFastBins;
const void* m_aGradientsAndHessians;
const void* m_aWeights;
const void* m_aPacked;
void* m_aFastBins;
};
struct BinSumsInteractionBridge {
BoolEbm m_bHessian;
size_t m_cScores;
size_t m_cSamples;
const void* m_aGradientsAndHessians;
const void* m_aWeights;
size_t m_cRuntimeRealDimensions;
size_t m_acBins[k_cDimensionsMax];
int m_acItemsPerBitPack[k_cDimensionsMax];
const void* m_aaPacked[k_cDimensionsMax];
void* m_aFastBins;
};
I/O Contract
| Structure | Purpose |
|---|---|
| ApplyUpdateBridge | Passes data for applying score updates and computing metrics |
| BinSumsBoostingBridge | Passes data for building 1-D boosting histograms |
| BinSumsInteractionBridge | Passes data for building multi-dimensional interaction histograms |
Usage Examples
# Called internally via native bindings
from interpret.glassbox import ExplainableBoostingClassifier
ebm = ExplainableBoostingClassifier()
ebm.fit(X, y) # Bridge structures transfer data between main and SIMD code