Skip to content

A TSK Fuzzy Inference System for Prediction Asphalt Quality.

Notifications You must be signed in to change notification settings

ParsaBordbar/fuzzy-asphalt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fuzzy Modeling of Asphalt Mechanical Properties

This project implements a complete Takagi–Sugeno–Kang (TSK) fuzzy inference system using the Wang–Mendel rule generation method to model mechanical properties of asphalt mixtures.

The system is implemented from scratch using:

  • NumPy

  • Pandas

  • Matplotlib

No external fuzzy logic libraries were used.

Objectives

  • Model nonlinear relationships between asphalt mixture parameters and mechanical properties.

  • Compare system performance using different numbers of fuzzy partitions.

  • Analyze rule growth and complexity.

  • Evaluate prediction quality using RMSE.

  • Visualize model interpretability and error behavior.

📂 Project Structure


  ctx3 print <- this tool is mine! check it's repo!
┌── 📂 Project structure:
├── .gitignore (4699 bytes)
├── README.md (5386 bytes)
├── data (96 bytes)
│   └── Asphalt-Dataset-ToClass.xlsx (32029 bytes)
├── plots (672 bytes) (Generated plots reside here!)
|
├── report (64 bytes)
└── src (352 bytes)
    ├── data_loader.py (947 bytes)
    ├── evaluation.py (257 bytes)
    ├── fuzzy_sets.py (1029 bytes)
    ├── preprocessing.py (692 bytes)
    ├── training.py (900 bytes)
    ├── tsk_model.py (1535 bytes)
    ├── visualize.py (3399 bytes)
    └── wang_mendel.py (1599 bytes)
 ├── main.py (1886 bytes)

You can use ctx3 (context tree) to quickly grasp the structure. click here to install ctx3

Methodology

The system follows the classical fuzzy modeling framework:

Data Preprocessing

  • 80% training / 20% testing split

  • Random shuffling with fixed seed

  • Min–Max normalization (training statistics only)


Fuzzy Partitioning

Each input variable is partitioned into:

  • 2 fuzzy sets

  • 3 fuzzy sets

  • 4 fuzzy sets

Uniform triangular membership functions are used.


Rule Generation (Wang–Mendel)

For each training sample:

  1. Select maximum membership per input

  2. Construct fuzzy rule

  3. Assign rule weight

  4. Remove duplicates (keep strongest)


TSK Inference

Zero-order TSK model:

$y = \frac{\sum w_k c_k}{\sum w_k}$

Where:

  • ( $w_k$ ) = firing strength

  • ( $c_k$ ) = rule consequent


Evaluation

Metric used:

$RMSE = \sqrt{\frac{1}{N} \sum (y_{true} - y_{pred})^2}$


Outputs Generated

After running the project, the following plots are saved inside /plots:

true_vs_pred_ITSM_Mpa_-_20_deg

For each of the 4 outputs:

  • RMSE vs number of fuzzy sets

  • Rule count vs number of fuzzy sets

  • True vs predicted scatter

  • Residual distribution

Additionally:

  • Membership function visualizations (selected inputs)

Total: ~19 plots.


How to Run

Option 1 — Using uv (Recommended)

If you use uv:

Step 1 — Install dependencies


uv add numpy pandas matplotlib openpyxl

(If already installed, skip this step.)

Step 2 — Run the project


uv run main.py

All plots will be saved automatically inside:


./plots


Option 2 — Without uv (Standard Python)

Step 1 — Create virtual environment (optional but recommended)


python -m venv venv

Activate it:

Mac/Linux


source venv/bin/activate

Windows


venv\Scripts\activate


Step 2 — Install dependencies


pip install numpy pandas matplotlib openpyxl


Step 3 — Run


python main.py


Required Dependencies

  • Python 3.9+

  • numpy

  • pandas

  • matplotlib

  • openpyxl


Experimental Results Summary

Rule Growth

Rule count increases with partition granularity.


Performance Trend

Best performance was achieved using:

2 fuzzy sets per input

Increasing the number of partitions:

  • Increased rule count

  • Increased model complexity

  • Led to mild overfitting

This demonstrates the classical bias–variance tradeoff.


Key Observations

  • ITSM outputs were predicted more accurately than Flow.

  • Increasing fuzzy granularity without increasing dataset size leads to sparse rule regions.

  • Proper data splitting and normalization were critical to avoid data leakage.

  • Results align with theoretical expectations from fuzzy system theory.


Conclusion

This project successfully demonstrates:

  • End-to-end fuzzy modeling

  • Wang–Mendel rule extraction

  • TSK inference

  • Complexity vs performance tradeoff

  • Interpretability through rule and membership visualization

The implementation is mathematically consistent and academically defensible.

License

Academic project implementation.

About

A TSK Fuzzy Inference System for Prediction Asphalt Quality.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages