Robustness: Classification

Experiment initialization and data preparation

from piml import Experiment
from piml.models import ReluDNNClassifier

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(ReluDNNClassifier(), name="ReluDNN")

Robustness test with default settings

exp.model_diagnose(model="ReluDNN", show="robustness_perf", figsize=(6, 4))
Model Performance: Perturb on All Features

Robustness test with custom perturbation features

exp.model_diagnose(model="ReluDNN", show="robustness_perf",
                   perturb_features=["BILL_AMT1", "BILL_AMT2", "BILL_AMT3"], figsize=(6, 4))
Model Performance: Perturb on 3 Features

Robustness test with custom perturbation size

exp.model_diagnose(model="ReluDNN", show="robustness_perf", perturb_size=0.2, figsize=(6, 4))
Model Performance: Perturb on All Features

Robustness test with custom perturbation method

exp.model_diagnose(model="ReluDNN", show="robustness_perf", perturb_method="quantile", figsize=(6, 4))
Model Performance: Perturb on All Features

Robustness test with custom metrics

exp.model_diagnose(model="ReluDNN", show="robustness_perf", metric="AUC", figsize=(6, 4))
Model Performance: Perturb on All Features

Robustness test on worst alpha-percent samples

exp.model_diagnose(model="ReluDNN", show="robustness_perf_worst", alpha=0.3, figsize=(6, 4))
30%-Worst Sample Performance

Total running time of the script: ( 1 minutes 9.751 seconds)

Estimated memory usage: 69 MB

Gallery generated by Sphinx-Gallery