Skip to main content

pyfuzzy-toolbox

PyPI version Python Versions License: MIT Downloads Documentation

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 →

  • 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

Basic Installation (Library only)

pip install pyfuzzy-toolbox

Full Installation (with Web Interface)

For the complete experience including the interactive web interface:

macOS/Linux (Zsh/Bash):

pip install 'pyfuzzy-toolbox[ui]'

Windows (PowerShell/CMD):

pip install pyfuzzy-toolbox[ui]

Note: Package name is pyfuzzy-toolbox, import as fuzzy_systems:

import fuzzy_systems as fs

🖥️ Web Interface (NEW!)

Launch the interactive web interface with a single command:

pyfuzzy interface

This opens a modern Streamlit-based interface featuring:

  • 🎯 ANFIS: Complete workflow (data → training → evaluation → prediction)
  • 📊 Interactive visualizations: Membership functions, decision surfaces, training curves
  • 🔮 Real-time predictions: Manual input or batch CSV upload
  • 📈 Model analysis: Rules visualization, feature importance, sensitivity analysis
  • 💾 Export capabilities: Models, predictions, and results

CLI Commands

# Launch web interface (browser opens automatically)
pyfuzzy interface

# Custom port and dark theme
pyfuzzy interface --port 8080 --dark-theme

# Headless mode (no browser)
pyfuzzy interface --no-browser

# Show version
pyfuzzy version

# Help
pyfuzzy --help

Programmatic API

Launch the interface from Python code or Jupyter notebooks:

from fuzzy_systems import launch_interface

# Simple launch
launch_interface()

# Custom configuration
launch_interface(
    port=8080,
    theme='dark',
    open_browser=True
)

🧩 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 2 notebooks Membership functions, fuzzy sets, operators, fuzzification
02_inference 4 notebooks Mamdani and Sugeno systems
03_learning 7 notebooks Wang-Mendel, ANFIS, optimization
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.

Mamdani System

Linguistic fuzzy inference with interpretable rules.

  • ✅ Intuitive rule creation
  • ✅ Multiple defuzzification methods
  • ✅ Visualization tools
  • 📓 Tipping Example

Sugeno System

Efficient inference with mathematical consequents.

  • ✅ Order 0 (constant) or Order 1 (linear)
  • ✅ Fast computation
  • ✅ Ideal for optimization
  • 📓 Zero-Order Example

🧠 Learning & Optimization

Automatic rule generation and parameter tuning from data.

Wang-Mendel

Single-pass rule extraction.

  • ✅ Fast learning
  • ✅ Auto task detection
  • ✅ Interpretable rules
  • 📓 Nonlinear Example

ANFIS

Neuro-fuzzy hybrid learning.

Mamdani Learning

Optimize existing systems.

  • ✅ SA, GA, PSO, DE
  • ✅ Preserve interpretability
  • ✅ Fine-tune consequents
  • 📓 Optimization Example

🌊 Dynamic Systems

Model temporal evolution with fuzzy uncertainty.

p-Fuzzy Discrete

Discrete-time dynamics.

  • ✅ x_{n+1} = x_n + f(x_n)
  • ✅ Absolute/relative modes
  • ✅ Population models
  • 📓 Predator-Prey Example

p-Fuzzy Continuous

Continuous-time dynamics.

Fuzzy ODE

ODEs with fuzzy uncertainty.

  • ✅ α-level method
  • ✅ Fuzzy parameters/ICs
  • ✅ Monte Carlo option
  • 📓 Logistic Example

📚 View All Guides


⚡ Quick Example

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

📝 Citation

@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 for details.

Release files for pyfuzzy-toolbox 1.1.8

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

Source distribution (sdist)

Source distribution for pyfuzzy-toolbox 1.1.8
File Size Uploaded
pyfuzzy_toolbox-1.1.8.tar.gz 6.7 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyfuzzy-toolbox 1.1.8
File Interpreter ABI Platform
pyfuzzy_toolbox-1.1.8-py3-none-any.whl Python 3 none any Details

Total release size: 7.0 MB

Release files / pyfuzzy_toolbox-1.1.8.tar.gz

Download URL pyfuzzy_toolbox-1.1.8.tar.gz
Size 6.7 MB
Tags Source
SHA-256 checksum
How to use checksums
d738c31d3dc5733a9c363e2eb09668c67328210ee2bf441e6b6bad801e931fa6
BLAKE2b-256 checksum
How to use checksums
8d3384bc3d718ce4f10fb193db34a2ed3f3a8dfdede2ed05eb093d18f5a7dbc8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.9

Release files / pyfuzzy_toolbox-1.1.8-py3-none-any.whl

Download URL pyfuzzy_toolbox-1.1.8-py3-none-any.whl
Size 314.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c637f094f8947d58dbab35f4838984897c1f80ab488ad002b1c7f0c2996fe128
BLAKE2b-256 checksum
How to use checksums
fff0605a7d21f0c34c154dff9f1776d3dbda981164902657a1ead72a5aee5ee6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.9

Release history Release notifications | RSS feed

This release

1.1.8 This release

2 release files

1.1.7

2 release files

1.1.6

2 release files

1.1.5

2 release files

1.1.4

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.1

2 release files

1.0.0

2 release files

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