SolePostHoc.jl provides a comprehensive suite of post-hoc analysis and optimization tools for symbolic learning models. The package enables knowledge extraction from both symbolic and non-symbolic models through a unified interface, facilitating the comparison of different interpretation methods while maintaining consistency and ease of use.
- LUMEN;
- InTrees;
- TREPAN;
- REFNE;
- RuleCOSI+;
- BATrees.
- Rule extraction from decision trees, random forests, and black-box models
- Model transformation and enhancement through rule minimization
- Performance optimization while preserving interpretability
- Support for surrogate model generation and knowledge distillation
All algorithms are accessible through a consistent API via the SolePostHoc.modalextractrules
function, enabling seamless comparison between different extraction methods.
# Call specific algorithms directly
extracted_rules = lumen(model)
extracted_rules = intrees(model, X_test, y_test)
# Use the unified interface with rule extractors
extractor_lumen = LumenRuleExtractor()
extractor_intrees = IntreesRuleExtractor()
decision_set_lumen = modalextractrules(extractor_lumen, model)
decision_set_intrees = modalextractrules(extractor_intrees, model, X_test, y_test)
The unified interface converts outputs into DecisionSet
objects—vectors of propositional logical rules in Disjunctive Normal Form (DNF), with one rule per class label.
using SolePostHoc
# Assume we have a trained Random Forest on the Iris dataset
rf_model = train_random_forest(X_train, y_train)
# Extract interpretable rules using LUMEN
extractor = LumenRuleExtractor()
interpretable_rules = modalextractrules(extractor, rf_model)
# The result is a DecisionSet with logical rules explaining the model's decisions
Surrogate Trees: Approximate complex models with interpretable decision trees.
Knowledge Distillation: Transfer knowledge from complex to transparent models.
Rule Extraction: Derive clear logical rules from any machine learning model.
SolePostHoc.jl is part of the Sole.jl ecosystem:
- SoleLogics.jl: Logical foundations
- SoleData.jl: Data handling
- SoleModels.jl: Model definitions
- SoleFeatures.jl: Feature engineering
For theoretical foundations, see: Modal Symbolic Learning: from theory to practice, G. Pagliarini (2024)
Developed by the ACLAI Lab @ University of Ferrara.