Command Line Interface (CLI)¶
pyfuzzy-toolbox includes a modern command-line interface for quick access to the web interface and other utilities.
Installation¶
To use the CLI, install pyfuzzy-toolbox with the [ui] extras:
Why the quotes?
On macOS/Linux (Zsh/Bash), the square brackets [] need to be quoted to prevent shell expansion.
Quick Start¶
Launch the web interface with a single command:
This will:
- ✅ Start the Streamlit server
- ✅ Automatically open your browser
- ✅ Display the interactive ANFIS interface
Press Ctrl+C to stop the server.
Available Commands¶
interface - Launch Web Interface¶
Open the interactive web application.
Options:
| Option | Type | Default | Description |
|---|---|---|---|
--port |
int | 8501 | Port number for the web server |
--host |
string | localhost | Host address to bind |
--dark-theme |
flag | False | Use dark theme |
--browser / --no-browser |
flag | True | Auto-open browser |
--help |
flag | - | Show help message |
Examples:
# Default: localhost:8501, auto-open browser
pyfuzzy interface
# Custom port
pyfuzzy interface --port 8080
# Dark theme without browser
pyfuzzy interface --dark-theme --no-browser
# Custom host (for remote access)
pyfuzzy interface --host 0.0.0.0 --port 8080
Port Auto-Detection
If the specified port is already in use, pyfuzzy will automatically find the next available port.
version - Show Version Info¶
Display package version and system information.
Output:
╭── Package Info ──╮
│ pyfuzzy-toolbox │
│ Version: 1.1.3 │
│ Python: 3.11.9 │
│ Platform: darwin │
╰──────────────────╯
demo - Run Demos¶
Run demonstration examples (coming soon).
Global Options¶
pyfuzzy --help # Show help for all commands
pyfuzzy --install-completion # Install shell completion
pyfuzzy --show-completion # Show completion script
Programmatic API¶
You can also launch the interface from Python code:
from fuzzy_systems import launch_interface
# Simple launch
launch_interface()
# Custom configuration
launch_interface(
port=8080,
host='localhost',
open_browser=True,
theme='dark'
)
Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
port |
int | None | Port number (auto-detects if None) |
host |
str | 'localhost' | Host address |
open_browser |
bool | True | Auto-open browser |
theme |
str | None | 'light' or 'dark' |
auto_find_port |
bool | True | Find free port if occupied |
Use Cases:
Jupyter Notebooks¶
Launch the interface alongside your notebook:
import fuzzy_systems as fs
# Train your model
model = fs.learning.ANFIS(n_inputs=2, n_mfs=3)
model.fit(X_train, y_train)
# Open interface for interactive analysis
fs.launch_interface()
Scripts and Automation¶
import fuzzy_systems as fs
# Run in headless mode for server deployment
fs.launch_interface(
host='0.0.0.0',
port=8501,
open_browser=False
)
Alternative: Python Module¶
If the pyfuzzy command is not available, use the Python module directly:
python -m fuzzy_systems.cli interface
python -m fuzzy_systems.cli version
python -m fuzzy_systems.cli --help
Troubleshooting¶
Command not found¶
Problem:
Solutions:
-
Verify installation:
-
Use Python module:
-
Check PATH:
-
Reinstall:
Port already in use¶
Problem:
This is normal! pyfuzzy automatically finds a free port. If you want a specific port:
Browser doesn't open¶
Problem: Server starts but browser doesn't open automatically.
Solutions:
-
Manual access: Open your browser and go to
http://localhost:8501 -
Check headless mode:
-
Try different browser: Set as default and retry
Streamlit not found¶
Problem:
Solution: Install with UI extras:
Web Interface Features¶
Once the interface is running, you'll have access to:
🎯 ANFIS Module¶
Complete workflow for Adaptive Neuro-Fuzzy Inference Systems:
- Dataset Tab
- Load CSV files
- Use classic datasets (Iris, Wine, Breast Cancer, Diabetes)
- Generate synthetic data
- Train/Validation/Test split
-
Data normalization
-
Training Tab
- Configure architecture (MFs, type)
- Hybrid Learning (backpropagation + LSE)
- Metaheuristic optimization (PSO, DE, GA)
- Regularization (L1/L2)
-
Real-time training curves
-
Metrics Tab
- Regression: RMSE, MAE, R², MAPE
- Classification: Accuracy, Precision, Recall, F1
- Scatter plots (Predicted vs Actual)
- Residual analysis
-
Confusion matrix
-
Prediction Tab
- Manual input with custom values
- Batch prediction (CSV upload)
-
Export predictions (Train/Val/Test)
-
Model Analysis Tab
- Architecture overview
- Membership functions visualization
- Fuzzy rules (3 views: Table, Visual Matrix, Activation)
- 3D decision surface (2-input models)
-
Feature importance (3 methods)
-
What is ANFIS? Tab
- Theory and explanation
- Architecture details
- Use cases
📊 Other Modules (Coming Soon)¶
- Mamdani Systems
- Sugeno Systems
- Wang-Mendel Learning
- Fuzzy ODEs
- p-Fuzzy Systems
Next Steps¶
- Installation Guide - Detailed installation instructions
- Quickstart Tutorial - Learn the basics
- ANFIS User Guide - Deep dive into ANFIS
- API Reference - Complete API documentation
Feedback¶
Having issues or suggestions? Please open an issue on GitHub!