Library to perform explainable AI using fuzzy logic.
Project description
Ex-Fuzzy
ex-Fuzzy is a fuzzy toolbox library for Python with special focus in its accesibility to use and visualization of results. In this way, we focus on the ex(-Fuzzy)plainable capacities of approximate reasoning.
Some of the tools available in this library include:
- Support for approximate reasoning using fuzzy association rules, for both classification and regression problems. This includes rule base optimization using genetic algorithms and rule visualization.
- Quantile-based and problem-optimized fuzzy variables and their correspondent linguistic variables (i.e low, medium, high).
- Support for various kinds of fuzzy sets, including classic fuzzy sets, IV-fuzzy sets and General Type 2 fuzzy sets. We also support linguistic hedges.
- Rule mining using support, confidence and lift measures. Customizable genetic optimization of the rule bases parameters.
Main Characteristics
Easy to use
ex-Fuzzy is designed to be easy to use. Linguistic variables can be precomputed and optimized without any understading of its implementation. Choosing one kind of fuzzy set only requires to set one flag.
Reusable code
Code is designed so that some parts can be easily extendable so that some use cases, like research, can be also supported. The rule base optimization is done using a Genetic Algorithm, but almost any other pymoo search algorithm will do. Fuzzy sets can be extended with ease, just as the kind of partitions, membership functions, etc.
Sci-py like interface
ex-Fuzzy is built taking into account the actual machine-learing frameworks used in Python. Training amd sing a rule base classifier works exactly as sci-kit learn classifier. Parameters such as the number of rules or antecedents are also built
Visualization
Use plots to visualize any kind of fuzzy sets, and use graphs to visualize rules or print them on screen.
Testing your patterns
ex-Fuzzy lets you study how reliable are your rules and their variable usage. You can easily repeat the experiments for statistical quantification of the results and then study the patterns obtained.
Support for many
Try some demos!
You can find them on Google colab:
- Basic classification demo
- Using a custom loss function
- Loading a text rule file
- Using a good set of rules for initial population
- Temporal fuzzy sets demo
- Rule mining classifiers
Dependencies
-
Numpy
-
Pandas
-
Matplotlib
-
Networkx
-
Pymoo
Installation
You can install ex-Fuzzy using pip, from the PyPi repository, with the following command:
pip install ex-fuzzy
Citation
You can check our paper in Neurocomputing.
In case you find exFuzzy useful, please cite it in your papers:
@article{fumanalex2024,
title = {Ex-Fuzzy: A library for symbolic explainable AI through fuzzy logic programming},
journal = {Neurocomputing},
pages = {128048},
year = {2024},
issn = {0925-2312},
doi = {https://doi.org/10.1016/j.neucom.2024.128048},
url = {https://www.sciencedirect.com/science/article/pii/S0925231224008191},
author = {Javier Fumanal-Idocin and Javier Andreu-Perez},
}
Contributors
Javier Fumanal Idocin, Javier Andreu-Perez
This project is licensed under the terms of the AGLP v3 license, 2021-2024
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file ex_fuzzy-1.5.1.tar.gz
.
File metadata
- Download URL: ex_fuzzy-1.5.1.tar.gz
- Upload date:
- Size: 74.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 559347cf9049b2ec2c4a98b657e012c4fdb40903f3343f6b69f4f8c661caa231 |
|
MD5 | 74ad5e8200d58790571be92012e4038d |
|
BLAKE2b-256 | eaeb36deb8148f97d034fded22d5b4baf998fcee0704d35d15b68c1b42be8486 |