This package implements the trustee framework to extract decision tree explanation from black-box ML models.
For more information, please visit the documentation website.
Standard AI/ML development pipeline extended by Trustee.
Getting Started
This section contains basic information and instructions to get started with Trustee.
Python Version
Trustee supports Python >=3.11.
Install Trustee
Use the following command to install Trustee:
$ pip install trustee
Sample Code
from sklearn import datasets
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import train_test_split
from sklearn.metrics import classification_report
from trustee import ClassificationTrustee
X, y = datasets.load_iris(return_X_y=True)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.30)
clf = RandomForestClassifier(n_estimators=100)
clf.fit(X_train, y_train)
y_pred = clf.predict(X_test)
trustee = ClassificationTrustee(expert=clf)
trustee.fit(X_train, y_train, num_iter=50, num_stability_iter=10, samples_size=0.3, verbose=True)
dt, pruned_dt, agreement, reward = trustee.explain()
dt_y_pred = dt.predict(X_test)
print("Model explanation global fidelity report:")
print(classification_report(y_pred, dt_y_pred))
print("Model explanation score report:")
print(classification_report(y_test, dt_y_pred))
Usage Examples
For simple usage examples of Trustee and TrustReport, please check the examples/ directory.
Other Use Cases
For other examples and use cases of how Trustee can used to scrutinize ML models, listed in the table below, please check our Use Cases repository.
| Use Case | Description |
|---|---|
| heartbleed_case/ | Trustee application to a Random Forest Classifier for an Intrustion Detection System, trained with CIC-IDS-2017 dataset pre-computed features. |
| kitsune_case/ | Trustee application to Kitsune model for anomaly detection in network traffic, trained with features extracted from Kitsune's Mirai attack trace. |
| iot_case/ | Trustee application to Random Forest Classifier to distguish IoT devices, trained with features extracted from the pcaps from the UNSW IoT Dataset. |
| moon_star_case/ | Trustee application to Neural Network Moon and Stars Shortcut learning toy example. |
| nprint_ids_case/ | Trustee application to the nPrintML AutoGluon Tabular Predictor for an Intrustion Detection System, also trained using pcaps from the CIC-IDS-2017 dataset. |
| nprint_os_case/ | Trustee application to the nPrintML AutoGluon Tabular Predictor for OS Fingerprinting, also trained using with pcaps from the CIC-IDS-2017 dataset. |
| pensieve_case/ | Trustee application to the Pensieve RL model for adaptive bit-rate prediction, and comparison to related work Metis. |
| vpn_case/ | Trustee application the 1D-CNN trained to detect VPN traffic trained with the ISCX VPN-nonVPN dataset. |
Supported AI/ML Libraries
| Library | Supported |
|---|---|
| scikit-learn | ✅ |
| Keras | ✅ |
| Tensorflow | ✅ |
| PyTorch | ✅ |
| AutoGluon | ✅ |
Citing us
@inproceedings{Jacobs2022,
title = {AI/ML and Network Security: The Emperor has no Clothes},
author = {A. S. Jacobs and R. Beltiukov and W. Willinger and R. A. Ferreira and A. Gupta and L. Z. Granville},
year = 2022,
booktitle = {Proceedings of the 2022 ACM SIGSAC Conference on Computer and Communications Security},
location = {Los Angeles, CA, USA},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
series = {CCS '22}
}
Metadata
Release files for trustee 1.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| trustee-1.2.0.tar.gz | 47.3 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| trustee-1.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 96.9 kB
Release files / trustee-1.2.0.tar.gz
| Download URL | trustee-1.2.0.tar.gz |
|---|---|
| Size | 47.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8417f6eaacfa0fb685771a71c65eabb98d8dc5461fc03d8cb6f84c517f9c58a8
|
|
BLAKE2b-256 checksum How to use checksums |
5fb4cc347dd74005a2e44dd70a393db9644892d6a5ee5babcb46349ce997fdaf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 24, 2026.
Transparency logRelease files / trustee-1.2.0-py3-none-any.whl
| Download URL | trustee-1.2.0-py3-none-any.whl |
|---|---|
| Size | 49.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8733e12514d7b11e3a55084f85ebabbafedadc1410cbf2c670e3936fc7ed05da
|
|
BLAKE2b-256 checksum How to use checksums |
8b452977716dadf0095ea39dc0b51aa28984d91ae11a628b41bec2074d7ee88c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 24, 2026.
Transparency logSecurity for trustee 1.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for trustee-1.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 24, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.