Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Implementation:Interpretml Interpret Ebm Predict Scores

From Leeroopedia


Field Value
Sources InterpretML
Domains Machine_Learning, Interpretability
Last Updated 2026-02-07 12:00 GMT

Overview

Ebm_Predict_Scores is a concrete tool for computing EBM prediction scores from discretized feature lookups provided by the InterpretML library.

Description

The ebm_predict_scores function computes raw model scores for input samples by discretizing features into bin indices and looking up corresponding values in each term's score tensor. All term contributions are summed with the intercept to produce the final scores. For classification, these raw scores are passed through an inverse link function separately. This additive decomposition is what makes EBM predictions fully interpretable: each term's contribution can be examined independently.

Usage

Import this function when you need raw EBM scores (before inverse link transformation). It is called internally by predict(), predict_proba(), explain_local(), and explain_global().

Code Reference

Source Location

Repository
interpretml/interpret
File
python/interpret-core/interpret/glassbox/_ebm/_bin.py
Lines
111--140

Signature

def ebm_predict_scores(
    X,
    n_samples,
    init_score,
    feature_names_in,
    feature_types_in,
    bins,
    intercept,
    term_scores,
    term_features,
):

Import

from interpret.glassbox._ebm._bin import ebm_predict_scores

I/O Contract

Inputs

Name Type Required Description
X array-like Yes Input feature matrix
n_samples int Yes Number of samples in X
init_score ndarray / None No Initial prediction scores to add to the output
feature_names_in list Yes Validated feature names from training
feature_types_in list Yes Validated feature types from training
bins list[list] Yes Bin definitions per feature (cut points for continuous, mappings for categorical)
intercept ndarray Yes Model intercept term
term_scores list[ndarray] Yes Per-term score lookup tables
term_features list[tuple] Yes Feature indices for each term (single index for main effects, pair for interactions)

Outputs

Name Type Description
return np.ndarray Predicted scores (raw, before inverse link transform). Shape is (n_samples,) for regression/binary classification or (n_samples, n_classes) for multiclass.

Usage Examples

Typical Usage via EBM Predict Methods

# ebm_predict_scores is called internally by the EBM predict methods:
from interpret.glassbox import ExplainableBoostingClassifier

ebm = ExplainableBoostingClassifier()
ebm.fit(X_train, y_train)

# Internal call chain:
# ebm.predict_proba(X) -> ebm_predict_scores(X, ...) -> inv_link(scores, ...)
# The raw scores are additive: score = intercept + sum(term_lookups)

predictions = ebm.predict(X_test)
probabilities = ebm.predict_proba(X_test)

Related Pages

Page Connections

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