Implementation:Interpretml Interpret PartitionMultiDimensionalFull
| Knowledge Sources | |
|---|---|
| Domains | Machine_Learning, EBM_Core |
| Last Updated | 2026-02-07 12:00 GMT |
Overview
Computes the full partition gain for multi-dimensional interaction terms by iterating over all tensor bins and calculating the improvement over the baseline.
Description
The PartitionMultiDimensionalFull.cpp file implements the PartitionMultiDimensionalFullInternal and PartitionMultiDimensionalFullTarget template classes. The core Func method iterates over all bins in a multi-dimensional histogram tensor, accumulating total gradient/hessian/weight/count statistics while simultaneously computing the per-bin partial gain using CalcPartialGain (with L1/L2 regularization and delta step capping). The final gain is computed by subtracting the total-bin gain from the sum of per-bin gains, measuring how much better individual bins predict compared to a single overall prediction. The function supports both Newton (hessian-based) and gradient boosting modes, selected via the CalcInteractionFlags_DisableNewton flag.
Usage
Called during interaction detection to compute the FAST interaction strength for a candidate feature pair. The gain value returned indicates how much predictive improvement can be obtained by including this interaction term in the model.
Code Reference
Source Location
- Repository: Interpretml_Interpret
- File: shared/libebm/PartitionMultiDimensionalFull.cpp
Signature
template<bool bHessian, size_t cCompilerScores>
class PartitionMultiDimensionalFullInternal final {
public:
INLINE_RELEASE_UNTEMPLATED static double Func(
InteractionCore* const pInteractionCore,
const size_t cTensorBins,
const CalcInteractionFlags flags,
const FloatCalc regAlpha,
const FloatCalc regLambda,
const FloatCalc deltaStepMax,
BinBase* const aAuxiliaryBinsBase,
BinBase* const aBinsBase);
};
template<bool bHessian, size_t cPossibleScores>
class PartitionMultiDimensionalFullTarget final {
public:
INLINE_RELEASE_UNTEMPLATED static double Func(
InteractionCore* const pInteractionCore,
const size_t cTensorBins,
const CalcInteractionFlags flags,
const FloatCalc regAlpha,
const FloatCalc regLambda,
const FloatCalc deltaStepMax,
BinBase* const aAuxiliaryBinsBase,
BinBase* const aBinsBase);
};
I/O Contract
| Input | Description |
|---|---|
| pInteractionCore | Core interaction state with score count |
| cTensorBins | Total number of bins in the multi-dimensional tensor |
| flags | CalcInteractionFlags (e.g., DisableNewton) |
| regAlpha | L1 regularization parameter |
| regLambda | L2 regularization parameter |
| deltaStepMax | Maximum step size cap |
| aBinsBase | Populated histogram bins |
| Output | Description |
|---|---|
| double return | Computed gain (interaction strength) |
Usage Examples
# Called internally via native bindings
from interpret.glassbox import ExplainableBoostingClassifier
ebm = ExplainableBoostingClassifier(interactions=10)
ebm.fit(X, y) # PartitionMultiDimensionalFull computes interaction gains