# pyfuzzy-toolbox
[](https://badge.fury.io/py/pyfuzzy-toolbox)
[](https://pypi.org/project/pyfuzzy-toolbox/)
[](https://opensource.org/licenses/MIT)
[](https://pepy.tech/project/pyfuzzy-toolbox)
[](https://1moi6.github.io/pyfuzzy-toolbox/)
A comprehensive Python library for Fuzzy Systems with focus on education and professional applications. Includes inference, learning, fuzzy differential equations, and p-fuzzy systems.
## 📚 Documentation
**[Read the full documentation →](https://1moi6.github.io/pyfuzzy-toolbox/)**
- **Getting Started**: Installation and quick tutorials
- **User Guides**: In-depth guides for each module
- **API Reference**: Complete method documentation
- **Examples**: 18+ interactive Colab notebooks
## 📦 Installation
```bash
pip install pyfuzzy-toolbox
```
**Note:** Package name is `pyfuzzy-toolbox`, import as `fuzzy_systems`:
```python
import fuzzy_systems as fs
```
## 🧩 Core Modules
### `fuzzy_systems.core`
Fundamental fuzzy logic components
- **Membership functions**: `triangular`, `trapezoidal`, `gaussian`, `sigmoid`, `generalized_bell`
- **Classes**: `FuzzySet`, `LinguisticVariable`
- **Operators**: `fuzzy_and_min`, `fuzzy_or_max`, `fuzzy_not`
### `fuzzy_systems.inference`
Fuzzy inference systems
- **MamdaniSystem**: Classic fuzzy inference with defuzzification (COG, MOM, etc.)
- **SugenoSystem**: TSK systems with functional outputs (order 0 and 1)
### `fuzzy_systems.learning`
Learning and optimization
- **ANFIS**: Adaptive Neuro-Fuzzy Inference System
- **WangMendel**: Automatic rule generation from data
- **MamdaniLearning**: Gradient descent and metaheuristics (PSO, DE, GA)
### `fuzzy_systems.dynamics`
Fuzzy dynamic systems
- **FuzzyODE**: Solve ODEs with fuzzy uncertainty (α-level method)
- **PFuzzySystem**: Discrete and continuous p-fuzzy systems
## 📓 Interactive Notebooks
Explore hands-on examples organized by topic:
| Topic | Notebooks | Description |
|-------|-----------|-------------|
| **[01_fundamentals](notebooks_colab/01_fundamentals/)** | 2 notebooks | Membership functions, fuzzy sets, operators, fuzzification |
| **[02_inference](notebooks_colab/02_inference/)** | 4 notebooks | Mamdani and Sugeno systems |
| **[03_learning](notebooks_colab/03_learning/)** | 7 notebooks | Wang-Mendel, ANFIS, optimization |
| **[04_dynamics](notebooks_colab/04_dynamics/)** | 5 notebooks | Fuzzy ODEs, p-fuzzy systems |
All notebooks can be opened directly in Google Colab!
## 📖 Quick Start Guides
Comprehensive guides for each module with theory, examples, and best practices:
### 🎛️ Inference Systems
Build fuzzy control systems and decision-making tools.
<table>
<tr>
<td width="50%">
**[Mamdani System](https://1moi6.github.io/pyfuzzy-toolbox/quick_start/mamdani_system/)**
Linguistic fuzzy inference with interpretable rules.
- ✅ Intuitive rule creation
- ✅ Multiple defuzzification methods
- ✅ Visualization tools
- 📓 [Tipping Example](notebooks_colab/02_inference/01_mamdani_tipping.ipynb)
</td>
<td width="50%">
**[Sugeno System](https://1moi6.github.io/pyfuzzy-toolbox/quick_start/sugeno_system/)**
Efficient inference with mathematical consequents.
- ✅ Order 0 (constant) or Order 1 (linear)
- ✅ Fast computation
- ✅ Ideal for optimization
- 📓 [Zero-Order Example](notebooks_colab/02_inference/03_sugeno_zero_order.ipynb)
</td>
</tr>
</table>
### 🧠 Learning & Optimization
Automatic rule generation and parameter tuning from data.
<table>
<tr>
<td width="33%">
**[Wang-Mendel](https://1moi6.github.io/pyfuzzy-toolbox/quick_start/wang_mendel/)**
Single-pass rule extraction.
- ✅ Fast learning
- ✅ Auto task detection
- ✅ Interpretable rules
- 📓 [Nonlinear Example](notebooks_colab/03_learning/wang_mendel_nonlinear.ipynb)
</td>
<td width="33%">
**[ANFIS](https://1moi6.github.io/pyfuzzy-toolbox/quick_start/anfis/)**
Neuro-fuzzy hybrid learning.
- ✅ Gradient descent
- ✅ Metaheuristics (PSO/DE/GA)
- ✅ High accuracy
- 📓 [Classification Example](notebooks_colab/03_learning/anfis_iris.ipynb)
</td>
<td width="33%">
**[Mamdani Learning](https://1moi6.github.io/pyfuzzy-toolbox/quick_start/mamdani_learning/)**
Optimize existing systems.
- ✅ SA, GA, PSO, DE
- ✅ Preserve interpretability
- ✅ Fine-tune consequents
- 📓 [Optimization Example](notebooks_colab/03_learning/rules_optimization.ipynb)
</td>
</tr>
</table>
### 🌊 Dynamic Systems
Model temporal evolution with fuzzy uncertainty.
<table>
<tr>
<td width="33%">
**[p-Fuzzy Discrete](https://1moi6.github.io/pyfuzzy-toolbox/quick_start/pfuzzy_discrete/)**
Discrete-time dynamics.
- ✅ x_{n+1} = x_n + f(x_n)
- ✅ Absolute/relative modes
- ✅ Population models
- 📓 [Predator-Prey Example](notebooks_colab/04_dynamics/pfuzzy_discrete_predator_prey.ipynb)
</td>
<td width="33%">
**[p-Fuzzy Continuous](https://1moi6.github.io/pyfuzzy-toolbox/quick_start/pfuzzy_continuous/)**
Continuous-time dynamics.
- ✅ dx/dt = f(x)
- ✅ Euler or RK4
- ✅ Adaptive stepping
- 📓 [Continuous Example](notebooks_colab/04_dynamics/pfuzzy_continuous_predator_prey.ipynb)
</td>
<td width="33%">
**[Fuzzy ODE](https://1moi6.github.io/pyfuzzy-toolbox/quick_start/fuzzy_ode/)**
ODEs with fuzzy uncertainty.
- ✅ α-level method
- ✅ Fuzzy parameters/ICs
- ✅ Monte Carlo option
- 📓 [Logistic Example](notebooks_colab/04_dynamics/fuzzy_ode_logistic.ipynb)
</td>
</tr>
</table>
**[📚 View All Guides](https://1moi6.github.io/pyfuzzy-toolbox/quick_start/quickstart_index/)**
---
## ⚡ Quick Example
```python
import fuzzy_systems as fs
# Create Mamdani system
system = fs.MamdaniSystem()
system.add_input('temperature', (0, 40))
system.add_output('fan_speed', (0, 100))
# Add terms
system.add_term('temperature', 'cold', 'triangular', (0, 0, 20))
system.add_term('temperature', 'hot', 'triangular', (20, 40, 40))
system.add_term('fan_speed', 'slow', 'triangular', (0, 0, 50))
system.add_term('fan_speed', 'fast', 'triangular', (50, 100, 100))
# Add rules
system.add_rules([('cold', 'slow'), ('hot', 'fast')])
# Evaluate
result = system.evaluate(temperature=25)
print(f"Fan speed: {result['fan_speed']:.1f}%")
```
## 🔗 Links
- **Documentation**: https://1moi6.github.io/pyfuzzy-toolbox/
- **PyPI**: https://pypi.org/project/pyfuzzy-toolbox/
- **GitHub**: https://github.com/1moi6/pyfuzzy-toolbox
## 📝 Citation
```bibtex
@software{pyfuzzy_toolbox,
title = {pyfuzzy-toolbox: A Comprehensive Python Library for Fuzzy Systems},
author = {Cecconello, Moiseis},
year = {2025},
url = {https://github.com/1moi6/pyfuzzy-toolbox},
note = {Includes inference, learning, fuzzy differential equations, and p-fuzzy systems}
}
```
## 📄 License
MIT License - see [LICENSE](LICENSE) for details.
Raw data
{
"_id": null,
"home_page": "https://github.com/1moi6/pyfuzzy-toolbox",
"name": "pyfuzzy-toolbox",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "Moiseis Cecconello <moiseis@gmail.com>",
"keywords": "fuzzy logic, p-fuzzy systems, fuzzy inference, mamdani, sugeno, anfis, wang-mendel, machine learning, fuzzy ode, p-fuzzy, artificial intelligence, control systems",
"author": "Moiseis Cecconello",
"author_email": "Moiseis Cecconello <moiseis@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/99/20/d4f363162f8098228bcfd21e3c7b9853f8926c510088b64f8968680cebe9/pyfuzzy_toolbox-1.0.7.tar.gz",
"platform": null,
"description": "# pyfuzzy-toolbox\n\n[](https://badge.fury.io/py/pyfuzzy-toolbox)\n[](https://pypi.org/project/pyfuzzy-toolbox/)\n[](https://opensource.org/licenses/MIT)\n[](https://pepy.tech/project/pyfuzzy-toolbox)\n[](https://1moi6.github.io/pyfuzzy-toolbox/)\n\nA comprehensive Python library for Fuzzy Systems with focus on education and professional applications. Includes inference, learning, fuzzy differential equations, and p-fuzzy systems.\n\n## \ud83d\udcda Documentation\n\n**[Read the full documentation \u2192](https://1moi6.github.io/pyfuzzy-toolbox/)**\n\n- **Getting Started**: Installation and quick tutorials\n- **User Guides**: In-depth guides for each module\n- **API Reference**: Complete method documentation\n- **Examples**: 18+ interactive Colab notebooks\n\n## \ud83d\udce6 Installation\n\n```bash\npip install pyfuzzy-toolbox\n```\n\n**Note:** Package name is `pyfuzzy-toolbox`, import as `fuzzy_systems`:\n```python\nimport fuzzy_systems as fs\n```\n\n## \ud83e\udde9 Core Modules\n\n### `fuzzy_systems.core`\nFundamental fuzzy logic components\n- **Membership functions**: `triangular`, `trapezoidal`, `gaussian`, `sigmoid`, `generalized_bell`\n- **Classes**: `FuzzySet`, `LinguisticVariable`\n- **Operators**: `fuzzy_and_min`, `fuzzy_or_max`, `fuzzy_not`\n\n### `fuzzy_systems.inference`\nFuzzy inference systems\n- **MamdaniSystem**: Classic fuzzy inference with defuzzification (COG, MOM, etc.)\n- **SugenoSystem**: TSK systems with functional outputs (order 0 and 1)\n\n### `fuzzy_systems.learning`\nLearning and optimization\n- **ANFIS**: Adaptive Neuro-Fuzzy Inference System\n- **WangMendel**: Automatic rule generation from data\n- **MamdaniLearning**: Gradient descent and metaheuristics (PSO, DE, GA)\n\n### `fuzzy_systems.dynamics`\nFuzzy dynamic systems\n- **FuzzyODE**: Solve ODEs with fuzzy uncertainty (\u03b1-level method)\n- **PFuzzySystem**: Discrete and continuous p-fuzzy systems\n\n## \ud83d\udcd3 Interactive Notebooks\n\nExplore hands-on examples organized by topic:\n\n| Topic | Notebooks | Description |\n|-------|-----------|-------------|\n| **[01_fundamentals](notebooks_colab/01_fundamentals/)** | 2 notebooks | Membership functions, fuzzy sets, operators, fuzzification |\n| **[02_inference](notebooks_colab/02_inference/)** | 4 notebooks | Mamdani and Sugeno systems |\n| **[03_learning](notebooks_colab/03_learning/)** | 7 notebooks | Wang-Mendel, ANFIS, optimization |\n| **[04_dynamics](notebooks_colab/04_dynamics/)** | 5 notebooks | Fuzzy ODEs, p-fuzzy systems |\n\nAll notebooks can be opened directly in Google Colab!\n\n## \ud83d\udcd6 Quick Start Guides\n\nComprehensive guides for each module with theory, examples, and best practices:\n\n### \ud83c\udf9b\ufe0f Inference Systems\nBuild fuzzy control systems and decision-making tools.\n\n<table>\n<tr>\n<td width=\"50%\">\n\n**[Mamdani System](https://1moi6.github.io/pyfuzzy-toolbox/quick_start/mamdani_system/)**\n\nLinguistic fuzzy inference with interpretable rules.\n\n- \u2705 Intuitive rule creation\n- \u2705 Multiple defuzzification methods\n- \u2705 Visualization tools\n- \ud83d\udcd3 [Tipping Example](notebooks_colab/02_inference/01_mamdani_tipping.ipynb)\n\n</td>\n<td width=\"50%\">\n\n**[Sugeno System](https://1moi6.github.io/pyfuzzy-toolbox/quick_start/sugeno_system/)**\n\nEfficient inference with mathematical consequents.\n\n- \u2705 Order 0 (constant) or Order 1 (linear)\n- \u2705 Fast computation\n- \u2705 Ideal for optimization\n- \ud83d\udcd3 [Zero-Order Example](notebooks_colab/02_inference/03_sugeno_zero_order.ipynb)\n\n</td>\n</tr>\n</table>\n\n### \ud83e\udde0 Learning & Optimization\nAutomatic rule generation and parameter tuning from data.\n\n<table>\n<tr>\n<td width=\"33%\">\n\n**[Wang-Mendel](https://1moi6.github.io/pyfuzzy-toolbox/quick_start/wang_mendel/)**\n\nSingle-pass rule extraction.\n\n- \u2705 Fast learning\n- \u2705 Auto task detection\n- \u2705 Interpretable rules\n- \ud83d\udcd3 [Nonlinear Example](notebooks_colab/03_learning/wang_mendel_nonlinear.ipynb)\n\n</td>\n<td width=\"33%\">\n\n**[ANFIS](https://1moi6.github.io/pyfuzzy-toolbox/quick_start/anfis/)**\n\nNeuro-fuzzy hybrid learning.\n\n- \u2705 Gradient descent\n- \u2705 Metaheuristics (PSO/DE/GA)\n- \u2705 High accuracy\n- \ud83d\udcd3 [Classification Example](notebooks_colab/03_learning/anfis_iris.ipynb)\n\n</td>\n<td width=\"33%\">\n\n**[Mamdani Learning](https://1moi6.github.io/pyfuzzy-toolbox/quick_start/mamdani_learning/)**\n\nOptimize existing systems.\n\n- \u2705 SA, GA, PSO, DE\n- \u2705 Preserve interpretability\n- \u2705 Fine-tune consequents\n- \ud83d\udcd3 [Optimization Example](notebooks_colab/03_learning/rules_optimization.ipynb)\n\n</td>\n</tr>\n</table>\n\n### \ud83c\udf0a Dynamic Systems\nModel temporal evolution with fuzzy uncertainty.\n\n<table>\n<tr>\n<td width=\"33%\">\n\n**[p-Fuzzy Discrete](https://1moi6.github.io/pyfuzzy-toolbox/quick_start/pfuzzy_discrete/)**\n\nDiscrete-time dynamics.\n\n- \u2705 x_{n+1} = x_n + f(x_n)\n- \u2705 Absolute/relative modes\n- \u2705 Population models\n- \ud83d\udcd3 [Predator-Prey Example](notebooks_colab/04_dynamics/pfuzzy_discrete_predator_prey.ipynb)\n\n</td>\n<td width=\"33%\">\n\n**[p-Fuzzy Continuous](https://1moi6.github.io/pyfuzzy-toolbox/quick_start/pfuzzy_continuous/)**\n\nContinuous-time dynamics.\n\n- \u2705 dx/dt = f(x)\n- \u2705 Euler or RK4\n- \u2705 Adaptive stepping\n- \ud83d\udcd3 [Continuous Example](notebooks_colab/04_dynamics/pfuzzy_continuous_predator_prey.ipynb)\n\n</td>\n<td width=\"33%\">\n\n**[Fuzzy ODE](https://1moi6.github.io/pyfuzzy-toolbox/quick_start/fuzzy_ode/)**\n\nODEs with fuzzy uncertainty.\n\n- \u2705 \u03b1-level method\n- \u2705 Fuzzy parameters/ICs\n- \u2705 Monte Carlo option\n- \ud83d\udcd3 [Logistic Example](notebooks_colab/04_dynamics/fuzzy_ode_logistic.ipynb)\n\n</td>\n</tr>\n</table>\n\n**[\ud83d\udcda View All Guides](https://1moi6.github.io/pyfuzzy-toolbox/quick_start/quickstart_index/)**\n\n---\n\n## \u26a1 Quick Example\n\n```python\nimport fuzzy_systems as fs\n\n# Create Mamdani system\nsystem = fs.MamdaniSystem()\nsystem.add_input('temperature', (0, 40))\nsystem.add_output('fan_speed', (0, 100))\n\n# Add terms\nsystem.add_term('temperature', 'cold', 'triangular', (0, 0, 20))\nsystem.add_term('temperature', 'hot', 'triangular', (20, 40, 40))\nsystem.add_term('fan_speed', 'slow', 'triangular', (0, 0, 50))\nsystem.add_term('fan_speed', 'fast', 'triangular', (50, 100, 100))\n\n# Add rules\nsystem.add_rules([('cold', 'slow'), ('hot', 'fast')])\n\n# Evaluate\nresult = system.evaluate(temperature=25)\nprint(f\"Fan speed: {result['fan_speed']:.1f}%\")\n```\n\n## \ud83d\udd17 Links\n\n- **Documentation**: https://1moi6.github.io/pyfuzzy-toolbox/\n- **PyPI**: https://pypi.org/project/pyfuzzy-toolbox/\n- **GitHub**: https://github.com/1moi6/pyfuzzy-toolbox\n\n## \ud83d\udcdd Citation\n\n```bibtex\n@software{pyfuzzy_toolbox,\n title = {pyfuzzy-toolbox: A Comprehensive Python Library for Fuzzy Systems},\n author = {Cecconello, Moiseis},\n year = {2025},\n url = {https://github.com/1moi6/pyfuzzy-toolbox},\n note = {Includes inference, learning, fuzzy differential equations, and p-fuzzy systems}\n}\n```\n\n## \ud83d\udcc4 License\n\nMIT License - see [LICENSE](LICENSE) for details.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A comprehensive Python library for fuzzy systems: inference (Mamdani, Sugeno), learning (ANFIS, Wang-Mendel, MandaniLearning), and dynamics (p-fuzzy, fuzzy ODEs)",
"version": "1.0.7",
"project_urls": {
"Bug Tracker": "https://github.com/1moi6/pyfuzzy-toolbox/issues",
"Changelog": "https://github.com/1moi6/pyfuzzy-toolbox/blob/main/CHANGELOG.md",
"Documentation": "https://github.com/1moi6/pyfuzzy-toolbox#readme",
"Homepage": "https://github.com/1moi6/pyfuzzy-toolbox",
"Repository": "https://github.com/1moi6/pyfuzzy-toolbox"
},
"split_keywords": [
"fuzzy logic",
" p-fuzzy systems",
" fuzzy inference",
" mamdani",
" sugeno",
" anfis",
" wang-mendel",
" machine learning",
" fuzzy ode",
" p-fuzzy",
" artificial intelligence",
" control systems"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "a894fad38075c5c90b22cb759c9dad706abf662b054ea33452e1447ab6490b4f",
"md5": "683f80064cf1ab80dcbe54ad179bb9f8",
"sha256": "5076ba0cf531cc4bba04ab937db96a2b6a7dd825f0195d3b9f6ea7ec5db4804f"
},
"downloads": -1,
"filename": "pyfuzzy_toolbox-1.0.7-py3-none-any.whl",
"has_sig": false,
"md5_digest": "683f80064cf1ab80dcbe54ad179bb9f8",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 141898,
"upload_time": "2025-11-01T20:56:22",
"upload_time_iso_8601": "2025-11-01T20:56:22.122537Z",
"url": "https://files.pythonhosted.org/packages/a8/94/fad38075c5c90b22cb759c9dad706abf662b054ea33452e1447ab6490b4f/pyfuzzy_toolbox-1.0.7-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "9920d4f363162f8098228bcfd21e3c7b9853f8926c510088b64f8968680cebe9",
"md5": "fe5d81c7fc0cd1eb50defdb4b0eeb946",
"sha256": "f6a3795ce71cd39e4cefbbebe13480af55438481b4bc634a0958e2ff2a95fc15"
},
"downloads": -1,
"filename": "pyfuzzy_toolbox-1.0.7.tar.gz",
"has_sig": false,
"md5_digest": "fe5d81c7fc0cd1eb50defdb4b0eeb946",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 6747419,
"upload_time": "2025-11-01T20:56:39",
"upload_time_iso_8601": "2025-11-01T20:56:39.357665Z",
"url": "https://files.pythonhosted.org/packages/99/20/d4f363162f8098228bcfd21e3c7b9853f8926c510088b64f8968680cebe9/pyfuzzy_toolbox-1.0.7.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-11-01 20:56:39",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "1moi6",
"github_project": "pyfuzzy-toolbox",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "pyfuzzy-toolbox"
}