SlideShare a Scribd company logo
Practical Insights into Fuzzy Logic
Dileepa Jayathilake
Manager Research – 99X Technology
Cofounder - Tracified
A bit about me
• Started with AI as an undergrad 16 years back
• Developed Sinhala Text-to-Speech and Speech Recognition using Artificial
Neural Networks and Hidden Markov Models
• Authored the open source fuzzy logic library ALLib
• Applied fuzzy logic in few industrial cases in Norway and China
• More recently worked on Brain Wave Analysis
• Current research interests: Blockchain, AI
What is Fuzzy Logic?
• AI technique to use when you want to combine human concepts
(which are inherently of vague nature) with computing
• Solves problems where crisp logic fails
What is fuzzy logic good for today?
Fuzzy Logic should be applied in cases where we have minimal
knowledge about the process to be modelled
- from a Fuzzy Logic Book from 90’s
?
Business Case 1: Geo-fencing
Sailor wants the app to wake him up if
the anchor is broken and the boat is
being dragged by wind
Perfect World Solution
Anchor
Location
Current
Location
Distance Moved (d)
Did the boat move by more than a predefined distance?
Location Readings are not perfect
Anchor
Location
Current
Location
Location readings are received along with a tolerance
T1
T2
Distance Moved (d)
Actual movement can be anything between d – T1 – T2 and d + T1 + T2
Tolerance can be Mild or Wild
• High Accuracy Mode
• Tolerance values are low
• Readings are received frequently
• Low Accuracy Mode
• Tolerance values are high
• Readings are received sparingly
It’s important to know which mode we are in
• In high accuracy mode
• Happily ignore intermittent readings with high tolerance
• Wait for the reading with best accuracy and treat it as a perfect reading
• In low accuracy mode
• Try to make use of every reading as only few readings are received
• Apply a geometric correction
Mode changes over time
• Apply ‘mode recognition logic’ periodically
• Lets say every 30 seconds
• Then use the correct approach to find answer to the question
“Should we ring the alarm?”
Determining the mode using Crisp Logic
Example:
If BEST_TOLERANCE < 20m && READING_COUNT >= 15
Mode = HIGH_ACCURACY
Else
Mode = LOW_ACCURACY
Now consider following 3 cases
Best Tolerance Reading Count
Case 1 18 15
Case 2 21 15
Case 3 18 13
Only Case 1 qualifies as High Accuracy
mode while intuition suggests that all 3
cases must be same mode
Alternative
Can’t we write the logic in a form like:
If BEST_TOLERANCE is LOW and READINGS_COUNT is VERY_HIGH Then there is a VERY_HIGH
possibility that we are in HIGH_ACCURACY Mode
Then we express our intuition on the case with further such rules:
If BEST_TOLERANCE is MEDIUM and READINGS_COUNT is MORE_OR_LESS_HIGH Then there is a
MEDIUM possibility that we are in HIGH_ACCURACY Mode
If BEST_TOLERANCE is VERY_HIGH and READINGS_COUNT is LOW Then there is a LOW possibility
that we are in HIGH_ACCURACY Mode
Bridging Human World and Machine World
Humans think in terms of concepts Machines think in terms of numbers
Can we build a logic to bridge these two worlds?
New form of the solution
We express our intuition on the case as a Rulebase built out of concepts
If BEST_TOLERANCE is LOW and READINGS_COUNT is VERY_HIGH Then there is a VERY_HIGH
possibility that we are in HIGH_ACCURACY Mode
If BEST_TOLERANCE is MEDIUM and READINGS_COUNT is MORE_OR_LESS_HIGH Then there is a
MEDIUM possibility that we are in HIGH_ACCURACY Mode
If BEST_TOLERANCE is VERY_HIGH and READINGS_COUNT is LOW Then there is a LOW possibility
that we are in HIGH_ACCURACY Mode
Then the machine solves the problem for us numerically!
BEST_TOLERANCE = 12 && READINGS_COUNT = 18 Mode = HIGH_ACCURACY
Possibility: The key to bridge the two worlds
Probability
Likelihood
Proportion
Possibility
Feasibility
Ease of Attainment
Possibility Distribution Function
Possibility
Value
X
1.0
0
Counterpart in the probability world is Probability Distribution Function
Membership Function
Possibility
Value
Low (Reading Count)
1.0
0
Counterpart in the probability world is Singular Value
2 15
Meaning of X is LOW
Possibility
Value
1.0
0
2 15
• When we don’t have any more information about X, pdf for ‘X is LOW’ is the membership function of LOW
• When we know X’s pdf, the pdf for ‘X is LOW’ is mf(LOW) o pdf(X)
Fuzzy Inference
Output pdf = ALSO{(input AND inputrulebase)IF-THEN outputrulebase}
Solution Configuration
Tolerance 1 = 8m ; Tolerance 2 = 15m ; Reading Count = 12
Is High Accuracy Mode?
Fuzzification & Defuzzification
Fuzzification Fuzzy
Inference
DeFuzzification
Fuzzy
Rulebase
Tolerance 1
Tolerance 2
pdf
pdf
pdf [0 … 1]
Challenges
• Defining membership functions
• Incompleteness of rulebase
Business Case 2: Customer Trust Index
How to quantify business value of a customer when you have sales data over a period?
Quantity : Total amount a customer has spent
Regularity : Frequency of Purchasing
Consistency : Predictability of the customer
Direct Solution
Parameter High Score Low Score
Quantity 10 1
Regularity 5 3
Predictability 8 2
E.g. Score(High Quantity, Low Regularity, Low Predictability) = 10 * 3 * 2 = 60
Fuzzy Logic based Solution
Define fuzzy input variables Quantity, Regularity and Predictability
Define fuzzy sets for each input variable’s domain
High_Value, Medium_Value, Somewhat_Low_Value, Insignificant_Value, …,Frequent, Regular, Occational, …, Recurring, Quasi-Predictable, Adhoc, …
Define fuzzy output variable Trust Index
Define fuzzy sets for output variable’s domain
Regular_Customer, Experimentor, Endorser, Adhoc_Customer, …
Define rulebase
If (Quantity is Somewhat_Low_Value) AND (Regularity is Frequent) Then Trust Index is Experimentor
If (Quantity is High_Value) AND (Regularity is Regular) AND (Predictability is Quasi-Predictable) Then Trust Index is Endorser
Ask the question: If Quantity = 100 ; Regularity = 7 ; Predictability = 8, What is the Trust Index?
Business Case 3: Customer Pain Point Analysis
How to quantify the importance
of customer pain points
reported?
Facts & Ideas
• Pain points are reported in 3 ways
• Phone complaints that result in a refund
• Phone complaints that do not result in a refund
• Internet reviews with low ratings
• Intuition suggests that the 3 types are in decreasing order of
importance
• Pain points that have an association of loss in customer trust index
have a special importance
Practical insights into fuzzy logic
Direct Solution
* alpha and beta are selected to be 2.0 and 1.5 to reflect the relative importance of the factor
they are multiplied with
Fuzzy Logic based Solution
• Input variables
• Customer Trust Index
• Drop in Customer Trust Index
• Phone complaint causing refund
• Phone complaint not causing refund
• Internet Review
• Output variable: Pain point score
• Multiplex before sending to fuzzy inference
• Evaluate per-review, defuzzify and take the sum
Results
Advantages using Fuzzy Logic
• Simplicity
• Ready for realtime applications (computationally lean)
• Human readability of rulebase
• Rulebase doesn’t have to be exhaustive
• Ability to explain the result
Blockchain AI
• Blockchains already use AI based agents as oracles
• Real “Blockchain AI” would be to use AI in consensus
• Fuzzy logic, because of its simplicity, is a good contender for that
Checkout my Fuzzy Logic library in Github
Questions

More Related Content

PDF
Ways to evaluate a machine learning model’s performance
PPTX
Online algorithms and their applications
PPTX
Introduction to Machine Learning
PPTX
AI Algorithms
PPTX
Machine Learning Unit 2 Semester 3 MSc IT Part 2 Mumbai University
PDF
Machine learning for deep learning
PDF
Statistics for deep learning
PPTX
Predictive model based on Supervised ML
Ways to evaluate a machine learning model’s performance
Online algorithms and their applications
Introduction to Machine Learning
AI Algorithms
Machine Learning Unit 2 Semester 3 MSc IT Part 2 Mumbai University
Machine learning for deep learning
Statistics for deep learning
Predictive model based on Supervised ML

Similar to Practical insights into fuzzy logic (20)

PDF
Fuzzy Logic & Artificial Neural Network 3
PDF
- Artificial Intelligence and its Applications in Construction Engineering an...
PPTX
Fuzzy logic
PPTX
Chapter 5 - Fuzzy Logic
PDF
Artificial neural networks
PPT
Fuzzy logic
PPTX
Fuzzy Logic in AI-Revamped easier and simple.pptx
PPTX
Fuzzy Logic Seminar with Implementation
PDF
Report on robotic control
PPTX
Fuzzy logicgccccccccccccccccccccccc.pptx
PDF
Fuzzy Self-Learning Controllers for Elasticity Management in Dynamic Cloud Ar...
PDF
Lec 5 uncertainty
PPTX
Short course fuzzy logic applications
PDF
On fuzzy concepts in engineering ppt. ncce
PDF
Optimization using soft computing
PPTX
Fuzzy Logic ppt
PPT
Artificial Intelligence Lecture Slide-07
PPTX
Lesson04-Uncertainty - Pt. 2 Fuzzy Methods.pptx
PDF
Week 10-END3971- Fuzzy Logic.pdf
PDF
Practical --2..pdf
Fuzzy Logic & Artificial Neural Network 3
- Artificial Intelligence and its Applications in Construction Engineering an...
Fuzzy logic
Chapter 5 - Fuzzy Logic
Artificial neural networks
Fuzzy logic
Fuzzy Logic in AI-Revamped easier and simple.pptx
Fuzzy Logic Seminar with Implementation
Report on robotic control
Fuzzy logicgccccccccccccccccccccccc.pptx
Fuzzy Self-Learning Controllers for Elasticity Management in Dynamic Cloud Ar...
Lec 5 uncertainty
Short course fuzzy logic applications
On fuzzy concepts in engineering ppt. ncce
Optimization using soft computing
Fuzzy Logic ppt
Artificial Intelligence Lecture Slide-07
Lesson04-Uncertainty - Pt. 2 Fuzzy Methods.pptx
Week 10-END3971- Fuzzy Logic.pdf
Practical --2..pdf
Ad

More from Dileepa Jayathilake (7)

PPTX
Adapting View Models as a Means For Sharing User Interface Code Between OS X ...
PPTX
A framework for building web sites that are friendly to visually impaired
PPTX
Tips for writing effective business case studies
PPTX
Towards structured log analysis
PPTX
A software monitoring framework for quality verification
PPTX
Research : A practical definition and a guideline
PPTX
A Novel Mind Map Based Approach for Log Data Extraction
Adapting View Models as a Means For Sharing User Interface Code Between OS X ...
A framework for building web sites that are friendly to visually impaired
Tips for writing effective business case studies
Towards structured log analysis
A software monitoring framework for quality verification
Research : A practical definition and a guideline
A Novel Mind Map Based Approach for Log Data Extraction
Ad

Recently uploaded (20)

PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
KodekX | Application Modernization Development
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
Cloud computing and distributed systems.
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
cuic standard and advanced reporting.pdf
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
KodekX | Application Modernization Development
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Dropbox Q2 2025 Financial Results & Investor Presentation
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Reach Out and Touch Someone: Haptics and Empathic Computing
The AUB Centre for AI in Media Proposal.docx
Diabetes mellitus diagnosis method based random forest with bat algorithm
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
NewMind AI Weekly Chronicles - August'25 Week I
Cloud computing and distributed systems.
Network Security Unit 5.pdf for BCA BBA.
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Mobile App Security Testing_ A Comprehensive Guide.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
Building Integrated photovoltaic BIPV_UPV.pdf
cuic standard and advanced reporting.pdf
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf

Practical insights into fuzzy logic

  • 1. Practical Insights into Fuzzy Logic Dileepa Jayathilake Manager Research – 99X Technology Cofounder - Tracified
  • 2. A bit about me • Started with AI as an undergrad 16 years back • Developed Sinhala Text-to-Speech and Speech Recognition using Artificial Neural Networks and Hidden Markov Models • Authored the open source fuzzy logic library ALLib • Applied fuzzy logic in few industrial cases in Norway and China • More recently worked on Brain Wave Analysis • Current research interests: Blockchain, AI
  • 3. What is Fuzzy Logic? • AI technique to use when you want to combine human concepts (which are inherently of vague nature) with computing • Solves problems where crisp logic fails
  • 4. What is fuzzy logic good for today? Fuzzy Logic should be applied in cases where we have minimal knowledge about the process to be modelled - from a Fuzzy Logic Book from 90’s ?
  • 5. Business Case 1: Geo-fencing Sailor wants the app to wake him up if the anchor is broken and the boat is being dragged by wind
  • 6. Perfect World Solution Anchor Location Current Location Distance Moved (d) Did the boat move by more than a predefined distance?
  • 7. Location Readings are not perfect Anchor Location Current Location Location readings are received along with a tolerance T1 T2 Distance Moved (d) Actual movement can be anything between d – T1 – T2 and d + T1 + T2
  • 8. Tolerance can be Mild or Wild • High Accuracy Mode • Tolerance values are low • Readings are received frequently • Low Accuracy Mode • Tolerance values are high • Readings are received sparingly
  • 9. It’s important to know which mode we are in • In high accuracy mode • Happily ignore intermittent readings with high tolerance • Wait for the reading with best accuracy and treat it as a perfect reading • In low accuracy mode • Try to make use of every reading as only few readings are received • Apply a geometric correction
  • 10. Mode changes over time • Apply ‘mode recognition logic’ periodically • Lets say every 30 seconds • Then use the correct approach to find answer to the question “Should we ring the alarm?”
  • 11. Determining the mode using Crisp Logic Example: If BEST_TOLERANCE < 20m && READING_COUNT >= 15 Mode = HIGH_ACCURACY Else Mode = LOW_ACCURACY Now consider following 3 cases Best Tolerance Reading Count Case 1 18 15 Case 2 21 15 Case 3 18 13 Only Case 1 qualifies as High Accuracy mode while intuition suggests that all 3 cases must be same mode
  • 12. Alternative Can’t we write the logic in a form like: If BEST_TOLERANCE is LOW and READINGS_COUNT is VERY_HIGH Then there is a VERY_HIGH possibility that we are in HIGH_ACCURACY Mode Then we express our intuition on the case with further such rules: If BEST_TOLERANCE is MEDIUM and READINGS_COUNT is MORE_OR_LESS_HIGH Then there is a MEDIUM possibility that we are in HIGH_ACCURACY Mode If BEST_TOLERANCE is VERY_HIGH and READINGS_COUNT is LOW Then there is a LOW possibility that we are in HIGH_ACCURACY Mode
  • 13. Bridging Human World and Machine World Humans think in terms of concepts Machines think in terms of numbers Can we build a logic to bridge these two worlds?
  • 14. New form of the solution We express our intuition on the case as a Rulebase built out of concepts If BEST_TOLERANCE is LOW and READINGS_COUNT is VERY_HIGH Then there is a VERY_HIGH possibility that we are in HIGH_ACCURACY Mode If BEST_TOLERANCE is MEDIUM and READINGS_COUNT is MORE_OR_LESS_HIGH Then there is a MEDIUM possibility that we are in HIGH_ACCURACY Mode If BEST_TOLERANCE is VERY_HIGH and READINGS_COUNT is LOW Then there is a LOW possibility that we are in HIGH_ACCURACY Mode Then the machine solves the problem for us numerically! BEST_TOLERANCE = 12 && READINGS_COUNT = 18 Mode = HIGH_ACCURACY
  • 15. Possibility: The key to bridge the two worlds Probability Likelihood Proportion Possibility Feasibility Ease of Attainment
  • 16. Possibility Distribution Function Possibility Value X 1.0 0 Counterpart in the probability world is Probability Distribution Function
  • 17. Membership Function Possibility Value Low (Reading Count) 1.0 0 Counterpart in the probability world is Singular Value 2 15
  • 18. Meaning of X is LOW Possibility Value 1.0 0 2 15 • When we don’t have any more information about X, pdf for ‘X is LOW’ is the membership function of LOW • When we know X’s pdf, the pdf for ‘X is LOW’ is mf(LOW) o pdf(X)
  • 19. Fuzzy Inference Output pdf = ALSO{(input AND inputrulebase)IF-THEN outputrulebase}
  • 20. Solution Configuration Tolerance 1 = 8m ; Tolerance 2 = 15m ; Reading Count = 12 Is High Accuracy Mode?
  • 21. Fuzzification & Defuzzification Fuzzification Fuzzy Inference DeFuzzification Fuzzy Rulebase Tolerance 1 Tolerance 2 pdf pdf pdf [0 … 1]
  • 22. Challenges • Defining membership functions • Incompleteness of rulebase
  • 23. Business Case 2: Customer Trust Index How to quantify business value of a customer when you have sales data over a period? Quantity : Total amount a customer has spent Regularity : Frequency of Purchasing Consistency : Predictability of the customer
  • 24. Direct Solution Parameter High Score Low Score Quantity 10 1 Regularity 5 3 Predictability 8 2 E.g. Score(High Quantity, Low Regularity, Low Predictability) = 10 * 3 * 2 = 60
  • 25. Fuzzy Logic based Solution Define fuzzy input variables Quantity, Regularity and Predictability Define fuzzy sets for each input variable’s domain High_Value, Medium_Value, Somewhat_Low_Value, Insignificant_Value, …,Frequent, Regular, Occational, …, Recurring, Quasi-Predictable, Adhoc, … Define fuzzy output variable Trust Index Define fuzzy sets for output variable’s domain Regular_Customer, Experimentor, Endorser, Adhoc_Customer, … Define rulebase If (Quantity is Somewhat_Low_Value) AND (Regularity is Frequent) Then Trust Index is Experimentor If (Quantity is High_Value) AND (Regularity is Regular) AND (Predictability is Quasi-Predictable) Then Trust Index is Endorser Ask the question: If Quantity = 100 ; Regularity = 7 ; Predictability = 8, What is the Trust Index?
  • 26. Business Case 3: Customer Pain Point Analysis How to quantify the importance of customer pain points reported?
  • 27. Facts & Ideas • Pain points are reported in 3 ways • Phone complaints that result in a refund • Phone complaints that do not result in a refund • Internet reviews with low ratings • Intuition suggests that the 3 types are in decreasing order of importance • Pain points that have an association of loss in customer trust index have a special importance
  • 29. Direct Solution * alpha and beta are selected to be 2.0 and 1.5 to reflect the relative importance of the factor they are multiplied with
  • 30. Fuzzy Logic based Solution • Input variables • Customer Trust Index • Drop in Customer Trust Index • Phone complaint causing refund • Phone complaint not causing refund • Internet Review • Output variable: Pain point score • Multiplex before sending to fuzzy inference • Evaluate per-review, defuzzify and take the sum
  • 32. Advantages using Fuzzy Logic • Simplicity • Ready for realtime applications (computationally lean) • Human readability of rulebase • Rulebase doesn’t have to be exhaustive • Ability to explain the result
  • 33. Blockchain AI • Blockchains already use AI based agents as oracles • Real “Blockchain AI” would be to use AI in consensus • Fuzzy logic, because of its simplicity, is a good contender for that
  • 34. Checkout my Fuzzy Logic library in Github