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

From Leeroopedia


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

Overview

Defines the BoosterCore class which manages the core state of an EBM boosting session, including features, terms, datasets, and objective functions.

Description

The BoosterCore.hpp header declares the BoosterCore class, the central object that holds all persistent state for EBM gradient boosting. It manages reference counting (via std::atomic_size_t) for thread-safe handle sharing, maintains arrays of features (FeatureBoosting), terms (Term), and term tensors (Tensor) for both current and best models. It holds separate training and validation DataSetBoosting objects, two ObjectiveWrapper instances (one for CPU scalar, one for SIMD), and various memory size tracking fields for bins, split positions, and tree nodes. The class uses a private destructor and constructor pattern with reference counting to control lifetime. The constructor initializes all pointers to nullptr and the best model metric to infinity.

Usage

Created once when a boosting session is initialized via the C API. The BoosterShell wraps a BoosterCore and exposes it through the opaque BoosterHandle. The BoosterCore persists across all boosting rounds and is freed when the reference count drops to zero.

Code Reference

Source Location

Signature

class BoosterCore final {
   std::atomic_size_t m_REFERENCE_COUNT;
   size_t m_cScores;
   BoolEbm m_bUseApprox;
   size_t m_cFeatures;
   FeatureBoosting* m_aFeatures;
   size_t m_cTerms;
   Term** m_apTerms;
   size_t m_cInnerBags;
   Tensor** m_apCurrentTermTensors;
   Tensor** m_apBestTermTensors;
   double m_bestModelMetric;
   DataSetBoosting m_trainingSet;
   DataSetBoosting m_validationSet;
   ObjectiveWrapper m_objectiveCpu;
   ObjectiveWrapper m_objectiveSIMD;

   inline void AddReferenceCount();
   static void Free(BoosterCore* const pBoosterCore);
   static ErrorEbm Create(BoosterCore** const ppOut, ...);
   static ErrorEbm InitializeTensors(const size_t cTerms, const Term* const* const apTerms,
       const size_t cScores, Tensor*** papTensorsOut);
};

I/O Contract

Field Description
m_REFERENCE_COUNT Thread-safe reference count for handle management
m_cScores Number of output scores (1 for binary/regression, K for multiclass)
m_trainingSet Training dataset with subsets per SIMD type
m_validationSet Validation dataset for early stopping
m_apCurrentTermTensors Current model term score tensors
m_apBestTermTensors Best model term score tensors (by validation metric)

Usage Examples

# Called internally via native bindings
from interpret.glassbox import ExplainableBoostingClassifier
ebm = ExplainableBoostingClassifier()
ebm.fit(X, y)  # Creates a BoosterCore internally to manage training state

Related Pages

Page Connections

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