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 InteractionCore Hpp

From Leeroopedia


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

Overview

Defines the InteractionCore class which manages the core state for EBM interaction detection, including features, dataset, and objective functions.

Description

The InteractionCore.hpp header declares the InteractionCore class, the central object for EBM feature interaction detection. It follows the same reference-counting pattern as BoosterCore, using std::atomic_size_t for thread-safe handle sharing. The class manages an array of FeatureInteraction objects, a DataSetInteraction for the full dataset, and two ObjectiveWrapper instances (CPU and SIMD). Unlike BoosterCore, it does not need terms or tensors since interaction detection only computes interaction strengths between feature pairs without building a model. The class provides a static Create factory method that initializes the dataset, features, and objectives, and an InitializeInteractionGradientsAndHessians method for setting up initial gradient values. It also includes a CheckTargets method for validating target values.

Usage

Created when the Python layer calls CreateInteractionDetector. Used to compute FAST (Friedman-Allen-Schreiber-Tibshirani) interaction strengths between feature pairs, which determines which feature interactions to include in the final EBM model.

Code Reference

Source Location

Signature

class InteractionCore final {
   std::atomic_size_t m_REFERENCE_COUNT;
   size_t m_cScores;
   BoolEbm m_bUseApprox;
   size_t m_cFeatures;
   FeatureInteraction* m_aFeatures;
   DataSetInteraction m_dataFrame;
   ObjectiveWrapper m_objectiveCpu;
   ObjectiveWrapper m_objectiveSIMD;

   inline void AddReferenceCount();
   inline size_t GetCountScores() const;
   inline const DataSetInteraction* GetDataSetInteraction() const;
   inline DataSetInteraction* GetDataSetInteraction();
   inline const FeatureInteraction* GetFeatures() const;
   inline size_t GetCountFeatures() const;

   static void Free(InteractionCore* const pInteractionCore);
   static ErrorEbm Create(const unsigned char* const pDataSetShared,
       const size_t cSamples, const size_t cFeatures, const size_t cWeights,
       const BagEbm* const aBag, const CreateInteractionFlags flags,
       const AccelerationFlags acceleration, const char* const sObjective,
       const double* const experimentalParams,
       InteractionCore** const ppInteractionCoreOut);

   ErrorEbm InitializeInteractionGradientsAndHessians(
       const unsigned char* const pDataSetShared, const size_t cWeights,
       const double* const aIntercept, const BagEbm* const aBag,
       const double* const aInitScores);
};

I/O Contract

Field Description
m_cScores Number of output scores
m_cFeatures Number of features in the dataset
m_dataFrame Full dataset for interaction detection
m_objectiveCpu CPU scalar objective wrapper
m_objectiveSIMD SIMD-accelerated objective wrapper

Usage Examples

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

Related Pages

Page Connections

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