This project implements Fuzzy Inference System (FIS) and Adaptive Neuro-Fuzzy Inference System (ANFIS) to predict liver disease using the Indian Liver Patient Dataset (ILPD).
The goal of this project is to demonstrate how fuzzy logic and neural learning can be combined to build interpretable medical decision systems.
Two models are implemented:
• Rule-based Fuzzy Inference System (FIS) • Data-driven Adaptive Neuro-Fuzzy Inference System (ANFIS)
Their performance is evaluated and compared on a medical dataset.
The project uses the Indian Liver Patient Dataset (ILPD) from the UCI Machine Learning Repository.
Features include:
- Age
- Gender
- Total Bilirubin
- Direct Bilirubin
- Alkaline Phosphatase
- Albumin
- Albumin and Globulin Ratio
Target variable:
1 → Liver Disease
0 → Normal
- Data preprocessing and normalization
- Feature selection
- Fuzzy membership function design
- Rule-based FIS implementation
- ANFIS model training
- Performance comparison
The FIS model uses expert-defined rules with triangular membership functions.
- Linguistic variables
- Membership functions
- Rule base
- Mamdani inference
- Defuzzification
The ANFIS model combines neural networks with fuzzy logic.
Layer 1 – Fuzzification Layer 2 – Rule Layer Layer 3 – Normalization Layer 4 – Consequent Layer Layer 5 – Output Layer

The models were evaluated using:
- Accuracy
- Precision
- Recall
- F1 Score
- ROC Curve
- Python
- NumPy
- Pandas
- Scikit-Learn
- Scikit-Fuzzy
- Matplotlib
- Seaborn
The ANFIS model outperforms the traditional rule-based FIS because it can automatically learn optimal parameters from data while preserving fuzzy interpretability.
Clone the repository
git clone https://github.com/fatimasood/anfis-liver-disease-prediction.git
Install dependencies
pip install -r requirements.txt
Run the notebook
jupyter notebook notebooks/liver_disease_fis_anfis.ipynb
Note: The objective of this project was learning Fuzzy Inference System (FIS) and an AdaptiveNeuro-Fuzzy Inference System (ANFIS) not to acheive high accuracy....

