Implementation:Interpretml Interpret Process Terms For Merge
| Field | Value |
|---|---|
| Sources | Repo: InterpretML |
| Domains | Federated_Learning, Machine_Learning |
| Updated | 2026-02-07 |
Overview
Concrete tool for finalizing merged EBM model outputs by aggregating scores and cleaning bins, reusing the process_terms utility in the merge context.
Description
This implementation reuses process_terms and remove_extra_bins from _utils.py, plus restore_missing_value_zeros from _tensor.py, in the specific context of finalizing a merged EBM model. After harmonized scores from multiple models have been combined, these functions compute the final averaged scores, standard deviations, and clean up unused bin levels.
Usage
This is called internally by merge_ebms as its final step.
Code Reference
| Field | Value |
|---|---|
| Source | interpretml/interpret |
| Primary File | python/interpret-core/interpret/glassbox/_ebm/_utils.py |
| process_terms Lines | 200-230 |
| remove_extra_bins Lines | 259-296 |
| generate_term_names Lines | 233-234 |
| Secondary File | python/interpret-core/interpret/glassbox/_ebm/_tensor.py |
| restore_missing_value_zeros Lines | 69-82 |
Signatures:
def process_terms(bagged_intercept, bagged_scores, bin_weights, bag_weights):
def remove_extra_bins(term_features, bins):
def generate_term_names(feature_names, term_features):
def restore_missing_value_zeros(tensor, weights):
Import:
from interpret.glassbox._ebm._utils import process_terms, remove_extra_bins, generate_term_names
from interpret.glassbox._ebm._tensor import restore_missing_value_zeros
I/O Contract
Same as Process_Terms (see that page) plus restore_missing_value_zeros:
| Function | Inputs | Outputs |
|---|---|---|
| process_terms | bagged_intercept, bagged_scores, bin_weights, bag_weights | intercept, term_scores, standard deviations |
| remove_extra_bins | term_features, bins | None (modifies bins in-place) |
| generate_term_names | feature_names, term_features | List of human-readable term name strings |
| restore_missing_value_zeros | tensor (ndarray), weights (ndarray) | None (modifies tensor in-place) |
Usage Examples
# Called internally by merge_ebms:
# intercept, term_scores, stds = process_terms(
# bagged_intercept, bagged_scores, bin_weights, bag_weights
# )
# remove_extra_bins(term_features, bins)
# term_names = generate_term_names(feature_names, term_features)
# for scores, weights in zip(term_scores, bin_weights):
# restore_missing_value_zeros(scores, weights)