Note
Go to the end to download the full example code or to run this example in your browser via Binder
GAM Classification (CoCircles)¶
Experiment initialization and data preparation
from piml import Experiment
from piml.models import GAMClassifier
exp = Experiment()
exp.data_loader(data="CoCircles", silent=True)
exp.data_prepare(target="target", task_type="classification", silent=True)
Train Model
exp.model_train(model=GAMClassifier(spline_order=2, n_splines=20, lam=0.6), name="GAM")
Evaluate predictive performance
exp.model_diagnose(model="GAM", show="accuracy_table")
ACC AUC F1 LogLoss Brier
Train 0.8363 0.9226 0.8387 0.3512 0.1130
Test 0.8475 0.9306 0.8432 0.3406 0.1062
Gap 0.0112 0.0080 0.0045 -0.0105 -0.0068
Global interpretation: effect plot for X0
exp.model_interpret(model="GAM", show="global_effect_plot", uni_feature="X0",
original_scale=True, figsize=(5, 4))
Global interpretation: effect plot for X1
exp.model_interpret(model="GAM", show="global_effect_plot", uni_feature="X1",
original_scale=True, figsize=(5, 4))
Global interpretation: feature importance
exp.model_interpret(model="GAM", show="global_fi", figsize=(5, 4))
Local interpretation
exp.model_interpret(model="GAM", show="local_fi", sample_id=0, original_scale=True, figsize=(5, 4))
Total running time of the script: ( 1 minutes 5.861 seconds)
Estimated memory usage: 12 MB