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 PartitionMultiDimensionalCorner

From Leeroopedia


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

Overview

PartitionMultiDimensionalCorner is a C++ module that finds optimal corner-based binary splits in multi-dimensional tensor space during EBM boosting.

Description

This module implements a corner-splitting algorithm for multi-dimensional interaction terms. Unlike straight (axis-aligned) splits that create planar boundaries, corner splits create L-shaped (or higher-dimensional corner-shaped) regions. The algorithm searches across all possible corner positions from all possible origin corners (2^N corners for N dimensions).

Key components include:

  • MakeTensor: A templated helper function that constructs the boosting update tensor from the best corner split found. It creates a tensor with two slices per dimension, computes predictions for the corner region and the complement region using gradient/hessian statistics, and supports Newton update (with hessian) and gradient-only update modes.
  • PartitionMultiDimensionalCornerInternal::Func: The main search function that iterates over all 2^N corner origins and all possible split positions within each dimension. For each candidate corner split, it computes:
    • The bin sums for the corner region using TensorTotalsSum
    • The complement region statistics (total minus corner)
    • The gain from splitting, considering minimum sample count requirements (cSamplesLeafMin), minimum hessian thresholds, regularization parameters (alpha, lambda), and maximum step size constraints

The algorithm tracks the best gain across all corners and split positions, then calls MakeTensor to construct the final update.

Usage

This module is called during boosting when processing multi-dimensional interaction terms. It provides an alternative to straight partitioning by searching for corner-shaped regions, which can capture certain interaction patterns that axis-aligned splits cannot.

Code Reference

Source Location

Signature

template<bool bHessian, size_t cCompilerScores>
class PartitionMultiDimensionalCornerInternal final {
public:
    static ErrorEbm Func(
        const size_t cRuntimeScores,
        const size_t cRealDimensions,
        const TermBoostFlags flags,
        const size_t cSamplesLeafMin,
        const FloatCalc hessianMin,
        const FloatCalc regAlpha,
        const FloatCalc regLambda,
        const FloatCalc deltaStepMax,
        const BinBase* const aBinsBase,
        BinBase* const aAuxiliaryBinsBase,
        Tensor* const pInnerTermUpdate,
        const size_t* const acBins,
        double* const pTotalGain
#ifndef NDEBUG
        ,
        const BinBase* const aDebugCopyBinsBase,
        const BinBase* const pBinsEndDebug
#endif
    );
};

I/O Contract

Inputs

Name Type Required Description
cRuntimeScores size_t Yes Number of score outputs
cRealDimensions size_t Yes Number of dimensions with more than 1 bin
flags TermBoostFlags Yes Boosting configuration flags (DisableNewtonGain, DisableNewtonUpdate)
cSamplesLeafMin size_t Yes Minimum number of samples required in each leaf region
hessianMin FloatCalc Yes Minimum hessian sum required in each leaf region
regAlpha FloatCalc Yes L1 regularization parameter
regLambda FloatCalc Yes L2 regularization parameter
deltaStepMax FloatCalc Yes Maximum step size for the update
aBinsBase const BinBase* Yes Pre-computed histogram bins for the interaction term
acBins const size_t* Yes Array of bin counts per dimension

Outputs

Name Type Description
return value ErrorEbm Error code (Error_None on success)
pInnerTermUpdate Tensor* Updated tensor containing the split scores
pTotalGain double* Total gain achieved by the best corner split

Usage Examples

Pipeline Context

# This C++ module is called internally via the native bindings
# during boosting of multi-dimensional interaction terms
from interpret.glassbox import ExplainableBoostingClassifier
ebm = ExplainableBoostingClassifier(interactions=10)
ebm.fit(X, y)  # Internally calls PartitionMultiDimensionalCorner for pair boosting

Related Pages

Page Connections

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