-
Notifications
You must be signed in to change notification settings - Fork 4
Releases: crillab/pyxai
PyXAI v2 — Stable Release
Assets 2
Version 2.0.0
API Reference documentation
This website now includes a dedicated API Reference section, generated from the PyXAI source docstrings. It covers the main modules and classes:
- Learning — the learning module (dataset loading, model training, instance selection)
- Explaining — the explainer module (initialisation, explanation computation)
- Builder — hand-crafting tree models
- Class references: Explainer, Learner, DecisionTree, RandomForest, and more.
Docstrings fully rewritten
All public docstrings have been rewritten with a consistent format (Parameters, Returns, Raises, Notes, Examples sections).
Updated API signatures
Several method signatures and module-level names were renamed as part of a broader refactoring to support non-tabular datasets (images, time series, etc.) stored in JSON format via the NonTabularPreprocessor class.
Imports
The Explainer entry point has been renamed Explaining:
| Old | New |
|---|---|
from pyxai import Learning, Explainer |
from pyxai import Learning, Explaining |
Explainer.initialize(model, instance) |
Explaining.initialize(model, instance) |
Learner.__init__()
| Old parameter | New parameter |
|---|---|
learner_type |
problem_type |
Learner.evaluate()
| Old parameter | New parameter |
|---|---|
method |
splitting_method |
output |
model_type |
**learner_options |
model_parameters={} |
test_size, n_models (positional) |
moved into splitting_parameters={} |
Hyperparameters passed via model_parameters now use the same parameter names as the underlying ML library (scikit-learn, XGBoost, LightGBM). For example, model_parameters={'n_estimators': 100, 'max_depth': 4} maps directly to scikit-learn's RandomForestClassifier(n_estimators=100, max_depth=4). There is no longer any PyXAI-specific naming for model hyperparameters.
Learner.get_instances()
| Old parameter | New parameter |
|---|---|
correct |
is_correct |
Constants in the Learning module
| Old constant | New constant |
|---|---|
Learning.TRAINING |
Learning.TRAIN |
Learning.MIXED |
Learning.TRAIN_IN_PRIORITY |
Save and load
| Old API | New API |
|---|---|
Learning.save(model, directory) |
Learning.ModelIO.save(model, directory) |
Learning.load(directory) |
Learning.ModelIO.load(directory) |
XGBoost compatibility
PyXAI is now compatible with the latest versions of XGBoost (previously limited to version 1.7.3).
Recent XGBoost releases changed how the base_score parameter is stored internally. The base_score is the initial bias added to all predictions before the trees are applied. Its handling differs by task:
- Binary classification — the base score is logit-transformed before being added to the sum of tree outputs.
- Multi-class classification — the base score is added to each class score before the softmax normalisation.
- Regression — the base score is a direct additive offset.
PyXAI now correctly extracts and applies base_score in all three cases, both for prediction and for computing formal explanations via the C++ backend. This fixes incorrect predictions and explanations that occurred with XGBoost versions newer than 1.7.3.
Refactoring and internal improvements
ModelIO utility class — save, load, and import operations have been extracted from the Learner class into a dedicated ModelIO static class. This makes the API cleaner and the import workflow consistent across all supported libraries (Scikit-learn, XGBoost, LightGBM):
from pyxai import Learning learner, model = Learning.import_models(saved_model)
Preprocessors split into two classes:
TabularPreprocessor— for standard CSV / DataFrame datasets.NonTabularPreprocessor— for non-tabular datasets (e.g. image datasets loaded from directories).
Private method naming — internal methods in data structure classes (BoostedTrees, DecisionTree, RandomForest) have been prefixed with _ to clearly distinguish the public API from implementation details.
Bug fixes:
- Fixed incorrect handling of discrete feature values in LightGBM models.
- Fixed XGBoost prediction errors introduced by the
base_scoreAPI change. - Fixed a memory issue in the Builder where
learner_informationwas incorrectly shared between instances.
Assets 2
v1.1.1
v1.1.1
Assets 2
V1.0.14
c173a9b PyXAI is available on MacOS via pypi: https://pypi.org/project/pyxai/1.0.14/
- Supports ARM architecture on Linux and MacOS
- Some bugs have been resolved
pip install -U pyxai to update or install.
Assets 2
v1.0.11
Assets 2
v1.0.10
- To resolve compatibility issues with PyQt6, since V1.0.10, PyXAI’s Graphical Interface is independent and no longer mandatory.
- Remove the PyQt6 dependency and implementation of new methods to display explanations without PyQt6:
- show_in_notebook()
- show_on_screen()
- get_PILImage()
- save_png()
- resize_PILimage()
- More information on a new page of the documentation
- Contrastive for BT classification (binary classes)(documentation in progress)
- Change function name in explainer (unset_specific_features -> unset_excluded_features)
- New procedure installation (github and pypi)
- New visualization for time series
image
More information at the end of this page. - Compilation error resolution
The documentation will be updated tomorrow.
Assets 2
v1.0.9
New metrics (documentation page is in progress)
For binary classification:
- accuracy
- precision
- recall
- f1_score
- specificity
- tp, tn, fp, fn
For multiclass classification:
- micro_averaging_accuracy
- micro_averaging_precision
- micro_averaging_recall
- macro_averaging_accuracy
- macro_averaging_precision
- macro_averaging_recall
For regression:
- mean_squared_error
- root_mean_squared_error
- mean_absolute_error
Examples:
labels = [1,1,1,1,1,0,0,0,0,0] predictions = [1,1,1,1,1,0,0,0,0,0] metrics = Tools.Metric.compute_metrics_binary_classification(labels, predictions)
learner = Learning.Scikitlearn("tests/dermatology.csv", learner_type=Learning.CLASSIFICATION) models = learner.evaluate(method=Learning.K_FOLDS, output=Learning.DT, test_size=0.2) for id, models in enumerate(models): metrics = learner.get_details()[id]["metrics"]
Assets 2
v1.0.7
Build and Tests with CI
Assets 2
V1.0.0
This is the release 1.0.0 of PyXAI with new features:
- Regression for Boosted Trees with XGBoost or LightGBM
- Adding Theories (knowledge about the dataset)
- Easier model Import (automatic detection of model types)
- PyXAI's Graphical User Interface (GUI): displaying, loading and saving explanations.
- Supports Multiple Image Formats for imaging datasets
- Supports Data Pre-Processing (tool for preparing and cleansing a dataset)
- Unit Tests with the Unittest module