DPG — Decision Predicate Graphs#
DPG is a model-agnostic tool to provide a global interpretation of tree-based ensemble models, addressing transparency and explainability challenges.
DPG is a graph structure that captures the tree-based ensemble model and learned dataset details, preserving the relations among features, logical decisions, and predictions towards emphasising insightful points. DPG enables graph-based evaluations and the identification of model decisions towards facilitating comparisons between features and their associated values while offering insights into the entire model. DPG provides descriptive metrics that enhance the understanding of the decisions inherent in the model, offering valuable insights
Install DPG and run your first explanation in minutes.
RandomForest, GradientBoosting, AdaBoost, and more.
Browse all graph and chart outputs available in DPG.
Full API documentation for dpg and metrics.
Internal change logs, design decisions, and migration notes.
Quick example#
from sklearn.ensemble import RandomForestClassifier
from sklearn.datasets import load_iris
from dpg import DPGExplainer
X, y = load_iris(return_X_y=True, as_frame=True)
model = RandomForestClassifier(n_estimators=5, random_state=42).fit(X, y)
explainer = DPGExplainer(
model,
feature_names=X.columns.tolist(),
target_names=["setosa", "versicolor", "virginica"],
)
explanation = explainer.fit(X.values)
explainer.plot(explanation)
Contents#
User Guide
Visualization
API Reference