Skip to main content

trust-free TRUST logo

PyPI version Python Downloads User Manual

Model. Explain. TRUST. All in one package.

Overview

trust-free is a Python package for fitting interpretable regression and classification models using Transparent, Robust, and Ultra-Sparse Trees (TRUST) — a new generation of Linear Model Trees (LMTs) with Random-Forest (RF) accuracy and intuitive explanations. The core methods are based on the PRICAI 2025 paper (Springer Nature, Lecture Notes in Artificial Intelligence) that introduced the TRUST algorithm.

It includes a state-of-the-art explainability suite, providing comprehensive, automatically-generated explanation reports. To see it in action, here are two 15-second demos showcasing the explain() and compare() methods applied to the famous Medical Insurance Charges dataset from Kaggle:

explain() method

TRUST’s explain() method — Straightforward prediction explanations

compare() method

TRUST’s compare() method — Comprehensive head-to-head profile comparisons

Proven Performance: Accuracy + Full Interpretability (60 Datasets)

Model Test R² ↑ Interpretable?
TRUST 0.67 ✅ Yes
Random Forest (RF) 0.62 ❌ No
Lasso 0.57 ✅ Yes
CART 0.49 ✅ Yes
Node Harvest (NH) 0.47 ✅ Yes
M5' (Linear Model Tree) 0.36 ⚠️ Partially

In the table above, TRUST is the only fully interpretable model statistically above 0.6 test R² across varied benchmark datasets — and 6× sparser than M5' (17 vs 109 coefficients on average).
Source: PRICAI 2025 (Springer LNAI)

See full benchmarks in the PRICAI 2025 paper


The package currently supports standard regression, multiclass classification, as well as experimental time-series regression tasks.

Key Advantages: RF Accuracy ⟡ Tree Transparency ⟡ Linear Interpretability

  • Hybrid power: Trees to capture non-linearity & interactions + sparse linear models (Adaptive or Relaxed Elastic Net) in leaves
  • Superior accuracy: RF-level accuracy, proven on 60 regression and 15 classification benchmarks
  • Full transparency: Every prediction is auditable via tree path + leaf equation
  • Inclusive: Regression explanation reports written in natural language accessible to all audiences
  • Compliant by design: 100% Compliant with the EU AI Act and the OECD AI Principles — ideal for high-stakes domains like finance and healthcare

Media

About this edition

  • ℹ️ Dataset Limits: ≤ 5,000 rows and ≤ 20 columns (intended for proof-of-concept, R&D and teaching)
  • ✅ Full Functionality: All core features are fully functional within these bounds
  • ✅ Standalone Tools: Relaxed Net (Renet™), Adaptive Logistic Regression (AdaLogit™), Adaptive Net, TurboSolve™ (fast OLS/ridge solver), Direct & Systemic Feature Importance
  • ⭐ No-Limit Utilities: TurboSolve™, Feature Importance methods, and our open-source Synthetic Dataset Generators (Toeplitz, Block-Correlated) can be used without restriction as standalone tools

Star ⭐ the project's GitHub repository and stay updated!

Installation

You can install this package using pip:

pip install trust-free

📦 Note: The package name on PyPI is trust-free, but the module you import in Python is trust: e.g. from trust import TRUSTRegressor.

What's new in this version? Cross-platform Python 3.13 support.

Check CHANGELOG.md on the project's GitHub to see this and all past release notes.

Platform Compatibility

Platform / Environment OS & Arch Python Status
Windows Intel/AMD Windows 11 x86_64 3.11–3.13 ✅ Working
macOS ARM64 (M1–M5) macOS 11+ ARM64 3.11–3.13 ✅ Working
Linux Intel/AMD manylinux x86_64 3.11–3.13 ✅ Working
Linux ARM64 manylinux ARM64 3.11–3.13 ✅ Working
Google Colab Linux x86_64 3.13 ✅ Working
Kaggle Notebooks Linux x86_64 3.11 ✅ Working*

*If Kaggle shows a dependency-compatibility error message upon installation via %pip install trust-free you may safely ignore it and simply restart your kernel: click Run, then Restart & clear cell outputs.

For a fully reproducible development environment with all dependencies, see SETUP.md.

Usage

Here are four simple examples showing how to use the trust-free package:

from trust import TRUSTRegressor, AdaLogitCV # note the import name is trust, not trust-free
from sklearn.datasets import make_regression
from sklearn.model_selection import train_test_split
from sklearn.metrics import r2_score, mean_squared_error, roc_auc_score

🧪 Example 1: Sparse Synthetic Regression (n=5000, p=20)

X, y, coefs = make_regression(n_samples=5000, n_features=20, n_informative=10, coef=True, noise=0.1, random_state=123)
print(coefs)

# Make Train-Test split
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=123)

# Instantiate and fit your model
model = TRUSTRegressor().fit(X_train, y_train)

# Predict and print results
y_pred = model.predict(X_test)
print("Predictions:", y_pred[:5])
print("True y values:", y_test[:5])
print("test R\u00B2:", r2_score(y_test, y_pred))
# Estimate direct variable importance for your fitted model
model.importance("direct", filename="Synthetic")
varImp
# Obtain a comprehensive prediction explanation for the first test observation
model.explain(X_test[0,:], mode="detailed", actual=y_test[0], filename="Synthetic") 
Explain1 PieChart

🩺 Example 2: Diabetes Dataset (n=442, p=10)

import pandas as pd
from sklearn import datasets
from sklearn.preprocessing import LabelEncoder

Diabetes = pd.DataFrame(datasets.load_diabetes().data)
Diabetes.columns = datasets.load_diabetes().feature_names
diab_target = datasets.load_diabetes().target
Diabetes.insert(len(Diabetes.columns), "Disease_marker", diab_target)
Diabetes_X = Diabetes.iloc[:,:-1]
# Binary encoding (0/1) for 'sex'
le = LabelEncoder()
Diabetes_X.loc[:, 'sex'] = le.fit_transform(Diabetes_X['sex']).astype(str)
Diabetes_y = Diabetes.iloc[:,-1]
model_Diabetes = TRUSTRegressor(max_depth=1).fit(Diabetes_X,Diabetes_y)
y_pred_TRUST = model_Diabetes.predict(Diabetes_X)
# Tree plotting requires Graphviz to be installed in your system path
# You can use e.g. Homebrew: brew install graphviz or Conda: conda install -c conda-forge graphviz
model_Diabetes.plot_tree("Diabetes") #will save "tree_plot_Diabetes.png" in your working directory
tree
# Obtain direct and systemic variable importance (with impact propagation heatmap) as well as ALE plots for all features
model_Diabetes.importance("direct", filename="Diabetes")
model_Diabetes.importance("systemic", filename="Diabetes")
varImp2 varImp3 varImp3b
ALEplot
# Obtain a prediction explanation for the second observation
model_Diabetes.explain(Diabetes_X.iloc[1,:], aim="decrease", actual=Diabetes_y[1], filename="Diabetes")
Explain2 Explain3a Explain3b Explain4
# Compare the second and fourth observations head-to-head
model_Diabetes.compare(Diabetes_X.iloc[1,:], Diabetes_X.iloc[3,:], filename="Diabetes")
Compare1 Radar Compare2 Pies

🆎 Example 3: Sparse Synthetic Classification (n=1000, p=20)

from trust.datasets import generate_block_corr_data_binY
X, y, beta, nonzero_ix, zero_ix = generate_block_corr_data_binY(n=1000, p=20, signal_scale=2.0, pi=0.5, random_state=0)

# Make Train-Test split
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=123)

# Instantiate and fit your model (scikit-learn compatible)
ALR = AdaLogitCV(l1_ratios=(0.95,), class_weight="balanced", scoring="neg_log_loss").fit(X_train, y_train)
print("Estimated coefficients:", np.round(ALR.coef_[0]))
print("True coefficients:", beta)

# Predict and print results
ALR_predictions = ALR.predict_proba(X_test)[:, 1]
print("Predictions:", np.round(ALR_predictions[:5],2))
print("True y values:", y_test[:5])
print("AdaLogit Test AUC =", round(roc_auc_score(y_test, ALR_predictions), 2))

📊 Example 4: 1-Permutation Feature Importance (n=100, p=10)

pip install --quiet tabicl # Only if tabicl is not installed yet
from tabicl import TabICLRegressor
from trust import FeatureImportance, datasets

X, y, coefs = datasets.make_block_correlated_regression(n_samples=100, n_features=10, n_informative=5, noise=1.0, rho=0.5, random_state=123)
model = TabICLRegressor().fit(X, y)
fi = FeatureImportance().fit(model.predict, X, y)
rel_importance = fi.direct_importance() # An order of magnitude faster than classical PFI
linear_scores = np.abs(coefs) / np.sum(np.abs(coefs))
print("Underlying linear model feature importance scores:", np.round(linear_scores, 2))
print("TabICL feature importance scores:", np.round(rel_importance, 2))
print("Underlying linear model feature importance directions:", np.sign(coefs))
print("TabICL feature importance directions:", fi.directions)

More Examples on Kaggle Datasets

License

For detailed terms, please refer to the LICENSE.txt file, which is also included with the distribution.

More Information

For more details and documentation visit:

https://github.com/adc-trust-ai/trust-free

Further technical details about TRUST™, Renet™ and our novel variable importance algorithms can be found in our preprints on arXiv:

https://www.arxiv.org/abs/2506.15791

https://arxiv.org/abs/2602.11107

https://arxiv.org/abs/2512.13892

Built with ❤️ by ADC at Whiteboxlab - Copyright © 2025-2026 Albert Dorador Chalar. All rights reserved. TRUST™, Renet™, AdaLogit™, and TurboSolve™ are trademarks of Albert Dorador Chalar.

Metadata

Release files for trust-free 3.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for trust-free 3.1.3
File
trust_free-3.1.3-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
trust_free-3.1.3-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ x86-64, Linux glibc 2.28+ x86-64 Details
trust_free-3.1.3-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ ARM64, Linux glibc 2.28+ ARM64 Details
trust_free-3.1.3-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details
trust_free-3.1.3-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
trust_free-3.1.3-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ x86-64, Linux glibc 2.17+ x86-64 Details
trust_free-3.1.3-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ ARM64, Linux glibc 2.17+ ARM64 Details
trust_free-3.1.3-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details
trust_free-3.1.3-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
trust_free-3.1.3-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ x86-64, Linux glibc 2.28+ x86-64 Details
trust_free-3.1.3-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ ARM64, Linux glibc 2.28+ ARM64 Details
trust_free-3.1.3-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details

Total release size: 15.0 MB

Release files / trust_free-3.1.3-cp313-cp313-win_amd64.whl

Download URL trust_free-3.1.3-cp313-cp313-win_amd64.whl
Size 1.4 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
55e538b35d2e9ea05907ce0de4a4e62484747e7c2cf74feb06524f96c4aa6bbe
BLAKE2b-256 checksum
How to use checksums
247bafd3ea52807ef81eb271a5a2fd419c1bb22f3feabad725178cdab6314ba0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release files / trust_free-3.1.3-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL trust_free-3.1.3-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 1.6 MB
Tags CPython 3.13 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
476b653588eb4c295399e1b84901089e857a40252cb368ab3d8b281161421181
BLAKE2b-256 checksum
How to use checksums
067bc680bb4c372d669db0617bd974c6f1583dd456e9f753b1b0a9371c036713
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release files / trust_free-3.1.3-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl

Download URL trust_free-3.1.3-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Size 1.4 MB
Tags CPython 3.13 Linux glibc 2.17+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
a7d7e294d88f3ddd38df61bb8c46c8303c6a84b010e7b0f831cff408f746da0b
BLAKE2b-256 checksum
How to use checksums
7c657d8704c0366e4421766d58362dbbe9610068563005e8edc1bae258c17df1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release files / trust_free-3.1.3-cp313-cp313-macosx_11_0_arm64.whl

Download URL trust_free-3.1.3-cp313-cp313-macosx_11_0_arm64.whl
Size 901.4 kB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
ce237fbc536e9c192c72fc5ca949823af24dc4dc011f2f9fd66627b53dd12f02
BLAKE2b-256 checksum
How to use checksums
8b4a60fb820b8a2525b954664396bc2f7d739cdd33db60a6e84c34baf184e1d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.1

Release files / trust_free-3.1.3-cp312-cp312-win_amd64.whl

Download URL trust_free-3.1.3-cp312-cp312-win_amd64.whl
Size 1.4 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
92f9bf964d9684a05dbf01739c743de3e968c5444c3b3a5d9c9afca5630f88b1
BLAKE2b-256 checksum
How to use checksums
4bc95e017e0b8ca0051de0da90007f308457f514b920cfdad006a4cae02fcfdd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release files / trust_free-3.1.3-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL trust_free-3.1.3-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 1.6 MB
Tags CPython 3.12 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
a0333b17c8037f0e86ad02c06a48ad33b5cf5456d06214d096fa3435024347f2
BLAKE2b-256 checksum
How to use checksums
b0437699eb4469d8384746f1ed7b2a0855d2590ea8139e04bfcb802a3493f269
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release files / trust_free-3.1.3-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl

Download URL trust_free-3.1.3-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Size 1.4 MB
Tags CPython 3.12 Linux glibc 2.17+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
c7e83f40f09abc39180b21164d49c0793d8481909946080b19fc0ff015326ec3
BLAKE2b-256 checksum
How to use checksums
b591fabe15dfe102486039ab3f506a2e036b4328a3826f2921df16e96cc09a17
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release files / trust_free-3.1.3-cp312-cp312-macosx_11_0_arm64.whl

Download URL trust_free-3.1.3-cp312-cp312-macosx_11_0_arm64.whl
Size 894.5 kB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
f75e711d825eeb546f43c71f7c880a98a51f4a624ee2119801b587b6cabfb5a4
BLAKE2b-256 checksum
How to use checksums
67c784c705fa5afc3323a0bad32fbb26928ef86251f8f2f28940a1b41cd2c91e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.1

Release files / trust_free-3.1.3-cp311-cp311-win_amd64.whl

Download URL trust_free-3.1.3-cp311-cp311-win_amd64.whl
Size 876.4 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
8441d7dd56228a6b6e82884f280210e93f73815252959c268e11285b18d7ecf8
BLAKE2b-256 checksum
How to use checksums
ab6ccd39f762e42bda98b34be6e138286598771706bb00d76b02d2eed83bb228
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release files / trust_free-3.1.3-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL trust_free-3.1.3-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 1.4 MB
Tags CPython 3.11 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
ab1b650712ecc011b2c3d5c40d38d5a618a3adbac5e3d9d59ad68cacbfd8061a
BLAKE2b-256 checksum
How to use checksums
d05b72cca618df32f4090733d2ecdc98121015dc542bfc8314ac28ed52ad8a71
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release files / trust_free-3.1.3-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl

Download URL trust_free-3.1.3-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Size 1.3 MB
Tags CPython 3.11 Linux glibc 2.17+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
4cb6f336a73982b6af151380fec05b9f47b750477f1c72c012884140fd3fd206
BLAKE2b-256 checksum
How to use checksums
fcd2debe20ec9761e70c550886c7c53b321c1721f67e577fee5808577cfbc004
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release files / trust_free-3.1.3-cp311-cp311-macosx_11_0_arm64.whl

Download URL trust_free-3.1.3-cp311-cp311-macosx_11_0_arm64.whl
Size 877.3 kB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
841b4acdb8697c8a37c9d21630911352edcf0f062daf21d58ee851c779d280cb
BLAKE2b-256 checksum
How to use checksums
fbe1b6d01e6446489ecacecbdf0c93b84a67a8dd0e08758dcfdb269289d881fc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.1

Release history Release notifications | RSS feed

This release

3.1.3 This release

12 release files

3.1.2

8 release files

3.1.1

8 release files

3.1.0

2 release files

3.0.0

8 release files

2.1.4

10 release files

2.1.3

2 release files

2.1.2

4 release files

2.1.1

2 release files

2.1.0

1 release file

2.0.0

1 release file

1.1.2

1 release file

1.1.1

1 release file

1.0.1

1 release file

1.0.0

1 release file

0.9.3

1 release file

0.9.2

1 release file

0.9.1

1 release file

0.9.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page