A Centroid-Based TSK Fuzzy Logic System This project uses Python virtual environments to manage dependencies and ensure consistent development environments across different machines.
- Python 3.6 or higher installed on your system
pip(Python package installer)
# Create a new virtual environment named 'venv'
python -m venv venv
# On some systems, you might need to use python3
python3 -m venv venvOn Windows:
# Command Prompt
venv\Scripts\activate
# PowerShell
venv\Scripts\Activate.ps1
# Git Bash
source venv/Scripts/activateOn macOS/Linux:
source venv/bin/activateWhen activated, you should see (venv) at the beginning of your command prompt.
# Upgrade pip to the latest version
pip install --upgrade pip
# Install project dependencies
pip install -r requirements.txtWhen you're done working on the project:
deactivate- Make sure your virtual environment is activated
- Install the package:
pip install package-name
- Update the requirements file:
pip freeze > requirements.txt
# Update a specific package
pip install --upgrade package-name
# Update requirements.txt after changes
pip freeze > requirements.txttsk_centroid/
├── .vscode/ # VS Code configs
├── notebooks/ # Jupyter Notebook playground
├── src/ # Source code
├── venv/ # Virtual environment (ignored by Git)
├── .gitignore # Git ignore file
├── LICENSE # LICENSE file
├── README.md # This file
├── EXPERIMENT_GUIDE.md # Detailed experiment instructions
└── requirements.txt # Project dependencies
This project contains multiple Jupyter notebook experiments for IT2TSK fuzzy inference system research. For detailed instructions on how to run each experiment, including:
- Step-by-step experiment workflow (Experiments 1-6)
- Parameter configuration and optimization
- Expected outputs and execution times
- Troubleshooting common issues
- Performance evaluation guidelines
👉 See EXPERIMENT_GUIDE.md for complete experiment instructions.
Using on Code Ocean
This project is designed to be compatible with Code Ocean, a cloud-based computational research platform. Code Ocean provides a reproducible research environment that's perfect for running these experiments.
- Create a New Capsule:
- Go to Code Ocean and create a new capsule
- Choose "Create New"
- Copy from public git url https://github.com/lumentut/tsk_centroid.git
- Enter the git url in the "Copy From Public git" dialog
- Click "Import"
- Install Packages:
- Select starter environment: "Python and R (Jupyterlab/RStudio) (3.12.8, R 4.4.2, JupyterLab 4.3.5, RStudio 2024.12.1-563)"
- Find the experiment.yml, while hover on the file, click the vertical three dot
- Click "Install packages"
- Click "Save"
Using Jupyter Notebooks
- Click "Jupyter" notebook icon below button "Reproducible Run"
- Open any experiment notebook (e.g.,
notebookx/experiment_1_mamdani_tsk_selection.ipynb) - Run cells sequentially as described in EXPERIMENT_GUIDE.md
Using Terminal Commands
- Open the terminal in Code Ocean by clicking "Terminal" icon below "Reproducible Run" button
- Navigate to project root:
cd /code - Run experiments using bin commands:
$ ./bin/mamdani_tsk_selection $ ./bin/it2tsk_mbk_exploration $ ./bin/it2tsk_hyperparameter_tuning
- Never commit the
venv/folder to Git - it's already excluded in.gitignore - Always activate the virtual environment before working on the project
- The
requirements.txtfile contains all the project dependencies - Different developers can use different virtual environment names (venv, env, .venv, etc.)
If you can't activate the virtual environment:
- Check that you're in the correct directory
- Verify the virtual environment was created successfully
- On Windows, try running as administrator or check PowerShell execution policy
On Windows PowerShell, you might need to change the execution policy:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser- Make sure Python is installed and added to your system PATH
- Try using
python3instead ofpython - On Ubuntu/Debian, you might need:
sudo apt install python3-venv
While this project uses the built-in venv module, you might encounter other tools:
- virtualenv: Third-party tool with more features
- conda: Popular for data science projects
- pipenv: Combines pip and virtualenv with dependency locking
- poetry: Modern dependency management with advanced features
If you encounter issues with the virtual environment setup:
- Ensure you have the correct Python version installed
- Check that you're running commands from the project root directory
- Verify your operating system's specific activation command
- Consult the Python venv documentation
- Clone the repository
- Navigate to the project directory
- Create virtual environment:
python -m venv venv - Activate virtual environment:
source venv/bin/activate(macOS/Linux) orvenv\Scripts\activate(Windows) - Install dependencies:
pip install -r requirements.txt - Verify setup:
python --versionandpip list - Start developing!
Remember to always activate your virtual environment before working on the project!
- D. R. Wijaya, R. Sarno, and E. Zulaika, “Electronic nose dataset for beef quality monitoring in uncontrolled ambient conditions,” Data Brief, vol. 21, pp. 2414–2420, Dec. 2018, doi: 10.1016/J.DIB.2018.11.091.
- D. Wu and J. M. Mendel, “Designing practical interval type-2 fuzzy logic systems made simple,” IEEE International Conference on Fuzzy Systems, pp. 800–807, Sep. 2014, doi: 10.1109/FUZZ-IEEE.2014.6891534.
- J. M. Mendel, “Uncertain Rule-Based Fuzzy Systems,” Uncertain Rule-Based Fuzzy Systems, 2017, doi: 10.1007/978-3-319-51370-6.
- A. A. Haghrah, S. Ghaemi, and M. A. Badamchizadeh, “PyIT2FLS: An open-source Python framework for flexible and scalable development of type 1 and interval type 2 fuzzy logic models,” SoftwareX, vol. 30, p. 102146, May 2025, doi: 10.1016/J.SOFTX.2025.102146.