ANFIS Toolbox
The most user-friendly Python library for Adaptive Neuro-Fuzzy Inference Systems (ANFIS)
ANFIS Toolbox is a comprehensive Python library for creating, training, and deploying Adaptive Neuro-Fuzzy Inference Systems (ANFIS). It provides an intuitive API that makes fuzzy neural networks accessible to both beginners and experts.
Key Features¶
Get started with just 3 lines of code
Supports both classification and regression tasks
13 membership functions
Fuzzy c-means, grid, and random initialization strategies
Multiple optimization algorithms
Rich collection of evaluation metrics
Comprehensive examples
Why ANFIS Toolbox?¶
π Simplicity First¶
Most fuzzy logic libraries require extensive boilerplate code. ANFIS Toolbox gets you running in seconds:
β‘ Quick Example¶
π Metrics & Evaluation¶
Want a structured report instead of a plain dictionary? Use evaluate to detect the task type automatically and access every score.
That's it! π You just created, trained and evaluate a neuro-fuzzy system!
Installation¶
Install the core package with minimal dependencies:
Use Cases¶
| Application | Description |
|---|---|
| Function Approximation | Learn complex mathematical functions |
| Regression | Predict continuous values |
| Classification | Predict discrete class labels |
| Time Series | Forecast future values |
Architecture¶
ANFIS Toolbox implements the complete 4-layer ANFIS architecture:
flowchart LR
%% Layer 1
subgraph L1 [layer 1]
direction TB
A1["A1"]
A2["A2"]
B1["B1"]
B2["B2"]
end
%% Inputs
x_input[x] --> A1
x_input --> A2
y_input[y] --> B1
y_input --> B2
%% Layer 2
subgraph L2 [layer 2]
direction TB
P1((Ξ ))
P2((Ξ ))
end
A1 --> P1
B1 --> P1
A2 --> P2
B2 --> P2
%% Layer 3
subgraph L3 [layer 3]
direction TB
N1((N))
N2((N))
end
P1 -- wβ --> N1
P1 ----> N2
P2 ----> N1
P2 -- wβ --> N2
%% Layer 4
subgraph L4 [layer 4]
direction TB
L4_1[x y]
L4_2[x y]
end
N1 -- wΜ
β --> L4_1
N2 -- wΜ
β --> L4_2
%% Layer 5
subgraph L5 [layer 5]
direction TB
Sum((Ξ£))
end
L4_1 -- "wβ fβ" --> Sum
L4_2 -- "wβ fβ" --> Sum
%% Output
Sum -- f --> f_out[f]
Supported Membership Functions¶
- Gaussian (
GaussianMF) - Smooth bell curves - Gaussian2 (
Gaussian2MF) - Two-sided Gaussian with flat region - Triangular (
TriangularMF) - Simple triangular shapes - Trapezoidal (
TrapezoidalMF) - Plateau regions - Bell-shaped (
BellMF) - Generalized bell curves - Sigmoidal (
SigmoidalMF) - S-shaped transitions - Diff-Sigmoidal (
DiffSigmoidalMF) - Difference of two sigmoids - Prod-Sigmoidal (
ProdSigmoidalMF) - Product of two sigmoids - S-shaped (
SShapedMF) - Smooth S-curve transitions - Linear S-shaped (
LinSShapedMF) - Piecewise linear S-curve - Z-shaped (
ZShapedMF) - Smooth Z-curve transitions - Linear Z-shaped (
LinZShapedMF) - Piecewise linear Z-curve - Pi-shaped (
PiMF) - Bell with flat top
Training Methods¶
- SGD (Stochastic Gradient Descent) β Classic gradient-based optimization with incremental updates
- Adam β Adaptive learning rates with momentum for faster convergence
- RMSProp β Scales learning rates by recent gradient magnitudes for stable training
- PSO (Particle Swarm Optimization) β Population-based global search strategy
- Hybrid SGD + OLS β Combines gradient descent with least-squares parameter refinement
- Hybrid Adam + OLS β Integrates adaptive optimization with analytical least-squares adjustment
What's Next?¶
- π‘ Examples - Real-world use cases
- π§ API Reference - Complete function documentation
- π€ ANFIS Models - Regression and classification models
- π Membership Functions - All MF classes
Community & Support¶
- π Report Issues - Bug reports and feature requests
- π¬ Discussions - Questions and feature requests
- π Developer Guide - Architecture notes and contribution workflow
- β Star on GitHub - Show your support!
Get started now