Implementation:Interpretml Interpret InteractionShell
| Knowledge Sources | |
|---|---|
| Domains | Machine_Learning, EBM_Core |
| Last Updated | 2026-02-07 12:00 GMT |
Overview
Implements the InteractionShell class lifecycle and the public C API entry point CreateInteractionDetector for creating interaction detection sessions.
Description
The InteractionShell.cpp file provides the implementation of InteractionShell methods (Free, Create, GetInteractionFastBinsTemp, GetInteractionMainBins) and the public C API function CreateInteractionDetector. The InteractionShell wraps an InteractionCore and manages temporary bin memory for interaction computations. The Create method allocates the shell, initializes it, and links it to the InteractionCore. GetInteractionFastBinsTemp and GetInteractionMainBins use AlignedGrow to lazily allocate and grow temporary bin buffers as needed. The CreateInteractionDetector C API function validates parameters, creates the InteractionCore, initializes gradients and hessians, creates the InteractionShell, and returns an opaque InteractionHandle to the caller.
Usage
Called from the Python native bindings when the user invokes interaction detection. The CreateInteractionDetector function is the entry point, and subsequent calls to CalcInteractionStrength use the returned handle to access the InteractionShell and its temporary bin memory.
Code Reference
Source Location
- Repository: Interpretml_Interpret
- File: shared/libebm/InteractionShell.cpp
Signature
void InteractionShell::Free(InteractionShell* const pInteractionShell);
InteractionShell* InteractionShell::Create(InteractionCore* const pInteractionCore);
BinBase* InteractionShell::GetInteractionFastBinsTemp(const size_t cBytes);
BinBase* InteractionShell::GetInteractionMainBins(
const size_t cBytesPerMainBin, const size_t cMainBins);
EBM_API_BODY ErrorEbm EBM_CALLING_CONVENTION CreateInteractionDetector(
const void* dataSet,
const double* intercept,
const BagEbm* bag,
const double* initScores,
CreateInteractionFlags flags,
AccelerationFlags acceleration,
const char* objective,
const double* experimentalParams,
InteractionHandle* interactionHandleOut);
I/O Contract
| Input (CreateInteractionDetector) | Description |
|---|---|
| dataSet | Shared dataset pointer |
| intercept | Model intercept values |
| bag | Sample bagging array |
| initScores | Initial prediction scores |
| objective | Objective function name string |
| interactionHandleOut | Output handle pointer |
| Output | Description |
|---|---|
| interactionHandleOut | Opaque handle to the created InteractionShell |
| ErrorEbm return | Error_None on success, error code on failure |
Usage Examples
# Called internally via native bindings
from interpret.glassbox import ExplainableBoostingClassifier
ebm = ExplainableBoostingClassifier(interactions=10)
ebm.fit(X, y) # InteractionShell is created via CreateInteractionDetector