Implementation:Interpretml Interpret Objective Registration
| Knowledge Sources | |
|---|---|
| Domains | Machine_Learning, EBM_Core |
| Last Updated | 2026-02-07 12:00 GMT |
Overview
Provides the objective registration framework, including parameter parsing classes and template dispatch machinery for creating objective instances from string-based configuration.
Description
The Registration.hpp header defines the infrastructure for registering objective functions by name and creating them from configuration strings. It includes parameter classes (ParamBase, FloatParam, BoolParam) for defining objective hyperparameters with defaults, the Registration base class for all registered objectives, and template utilities (index_sequence, make_index_sequence, call_with_tuple) for unpacking parameter tuples into function calls. The registration system allows objectives to be looked up by name string and instantiated with parsed parameters, enabling the Python layer to specify objectives like "log_loss" or "rmse" as strings that get resolved to the appropriate C++ implementations.
Usage
Used at library initialization to register all available objectives, and at runtime when the Python layer requests a specific objective by name. The registration system dispatches to the correct templated implementation based on the string name and configuration parameters.
Code Reference
Source Location
- Repository: Interpretml_Interpret
- File: shared/libebm/compute/Registration.hpp
Signature
class ParamBase {
INLINE_ALWAYS const char* GetParamName() const noexcept;
};
class FloatParam final : public ParamBase {
typedef double ParamType;
INLINE_ALWAYS double GetDefaultVal() const noexcept;
INLINE_ALWAYS FloatParam(const char* const sParamName, const double defaultVal);
};
class BoolParam final : public ParamBase {
typedef bool ParamType;
};
template<typename Func, typename Tuple>
bool call_with_tuple(Func& f, const AccelerationFlags zones,
const Config* const pConfig, const char* const sRegistration,
const char* const sRegistrationEnd, void* const pWrapperOut, const Tuple& t);
I/O Contract
| Component | Input | Output |
|---|---|---|
| FloatParam | Parameter name string, default double value | Named float parameter definition |
| BoolParam | Parameter name string, default bool value | Named boolean parameter definition |
| call_with_tuple | Function, config, registration string, param tuple | bool indicating success/failure |
Usage Examples
# Called internally via native bindings
from interpret.glassbox import ExplainableBoostingClassifier
ebm = ExplainableBoostingClassifier(objective="log_loss")
ebm.fit(X, y) # Registration system resolves "log_loss" to the C++ implementation