This project uses fuzzy logic to recommend a tip amount based on service, food, income, and party size. Instead of strict thresholds, fuzzy logic uses degrees of membership to calculate reasonable yet concise solutions.
- Fuzzy Inputs: service quality (poor, average, good), food quality (terrible, average, delicious), income (low, medium, high), party size (small, medium, large)
- Fuzzy Output: centroid defuzzification is used to calculate tip percentage (low, medium, high)
- Fuzzy Rules:
- If service is poor OR food is terrible, then tip is low
- If service is good AND food is delicious, then tip is high
- If service is average AND food is average, then tip is medium
- If party size is large OR income is high, then tip is high
- If party size is small AND income is low, then tip is low
- If income is medium, then tip is medium
- Membership Functions: Each fuzzy input is given a specified range, which is visualized in matplotlib
Python 3.9 or Python 3.10
- Clone the repository:
git clone https://github.com/hyao03/Fuzzy_Tipping_Project - Install dependencies:
pip install -r requirements.txt - Run the program:
python fuzzytipping.py
- Graphs for each membership function are displayed for the inputs and output
- The final recommended tip percentage is displayed
MIT