Note
Go to the end to download the full example code or to run this example in your browser via Binder
FIGS Classification (Taiwan Credit)¶
Experiment initialization and data preparation
from piml import Experiment
from piml.models import FIGSClassifier
exp = Experiment()
exp.data_loader(data="TaiwanCredit", silent=True)
exp.data_summary(feature_exclude=["LIMIT_BAL", "SEX", "EDUCATION", "MARRIAGE", "AGE"], silent=True)
exp.data_prepare(target="FlagDefault", task_type="classification", silent=True)
Train Model
exp.model_train(model=FIGSClassifier(max_iter=100, max_depth=4), name="FIGS")
Evaluate predictive performance
exp.model_diagnose(model="FIGS", show="accuracy_table")
ACC AUC F1 LogLoss Brier
Train 0.8246 0.7891 0.4926 0.4205 0.1312
Test 0.8218 0.7637 0.4636 0.4378 0.1357
Gap -0.0028 -0.0255 -0.0290 0.0173 0.0045
Global interpretation for the splits heatmap
exp.model_interpret(model="FIGS", show="figs_heatmap", tree_idx=0, figsize=(12, 4))
Global interpretation for the first tree
exp.model_interpret(model="FIGS", show="tree_global", tree_idx=0, root=0,
depth=3, original_scale=True, figsize=(16, 10))
Global interpretation for the second tree
exp.model_interpret(model="FIGS", show="tree_global", tree_idx=1, root=0,
depth=3, original_scale=True, figsize=(16, 10))
Local interpretation for the first tree
exp.model_interpret(model="FIGS", show="tree_local", sample_id=0, tree_idx=0,
original_scale=True, figsize=(16, 10))
Local interpretation for the second tree
exp.model_interpret(model="FIGS", show="tree_local", sample_id=0, tree_idx=1,
original_scale=True, figsize=(16, 10))
Total running time of the script: ( 1 minutes 13.044 seconds)
Estimated memory usage: 43 MB