Implementation:Interpretml Interpret To Jsonable
Appearance
| Field | Value |
|---|---|
| Sources | Repo: InterpretML |
| Domains | Model_Persistence, Interoperability |
| Updated | 2026-02-07 |
Overview
Concrete tool for serializing a fitted EBM to JSON format provided by the InterpretML library.
Description
The to_jsonable function converts a fitted EBM model into a JSON-compatible Python dictionary. It supports four detail levels controlling which attributes are included. The output can be passed to json.dumps() for file storage.
Usage
Call this to serialize a fitted EBM for storage, API transmission, or model merging workflows.
Code Reference
| Field | Value |
|---|---|
| Source | interpretml/interpret |
| File | python/interpret-core/interpret/glassbox/_ebm/_json.py |
| Lines | 321-388 |
Signature:
def to_jsonable(ebm, detail="all"):
"""Converts the model to a JSONable representation.
Args:
detail: 'minimal', 'interpretable', 'mergeable', 'all'
Returns:
JSONable object
"""
Import:
from interpret.glassbox._ebm._json import to_jsonable
I/O Contract
Inputs:
| Parameter | Type | Required | Description |
|---|---|---|---|
| ebm | fitted EBM | Yes | A fitted ExplainableBoostingClassifier or ExplainableBoostingRegressor instance |
| detail | str | No | Detail level: "minimal", "interpretable", "mergeable", or "all" |
Outputs:
| Type | Description |
|---|---|
| dict | Dictionary with "version" and "ebm" keys containing full model serialization |
Usage Examples
import json
from interpret.glassbox import ExplainableBoostingClassifier
from interpret.glassbox._ebm._json import to_jsonable
ebm = ExplainableBoostingClassifier()
ebm.fit(X_train, y_train)
# Serialize to JSON
model_dict = to_jsonable(ebm, detail="all")
with open("ebm_model.json", "w") as f:
json.dump(model_dict, f)
Related Pages
Page Connections
Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment