Inference with Fuzzy IF-THEN Rules

This Demonstration illustrates the interpolation method for a system of fuzzy IF-THEN rules. In particular, it shows how to calculate the suitability of a house given the following three rules:
- IF (House is Inexpensive OR Close-to-work), THEN Suitability is Good.
- IF (House is Expensive OR Far-from-work), THEN Suitability is Low.
- IF (House is Average-priced AND About-50-km-from-work), THEN Suitability is Regular.
These rules contain imprecise concepts -such as "Expensive" or "Close-to-work"- which are formalized as fuzzy sets. A fuzzy set F (e.g. denoting the concept "Expensive") is defined by a membership function that assigns to each possible element x within a certain universe of discourse X (e.g. all the houses in the world) a value μF(x) between 0 and 1 that denotes the extent to which that element x (e.g. a particular house) belongs to the fuzzy set (i.e. the extent to which the particular house is expensive). In the example above, the extent to which a house of price=110 is expensive is μExpensive(price=110)0.55 (see the membership function of "Expensive" on the mid-left of the demonstration, plotted as a function of the price of the house).


  • [Snapshot]
  • [Snapshot]
  • [Snapshot]


This Demonstration illustrates the so-called interpolation method for multiconditional approximate reasoning systems of fuzzy IF-THEN rules [1], including fuzzification and defuzzification. A particular instance of this method is Mamdani inference (also called max-min inference), which is often used in fuzzy control. Another particular instance is max-prod inference. The method consists of the following four steps:
1. Calculate the degree of consistency between the inputs and the antecedent of each IF-THEN rule. The Demonstration lets you choose different functions for the logical operators (AND, OR). As an example, consider the first rule at the top row, with antecedent "Inexpensive OR Close-to-work". The computation for crisp inputs price=110 and distance=57, using the function Max (maximum) as logical OR, would be: OR(Inexpensive(110), Close-to-work(57)) ⟶ OR(0.45,0.16) ⟶ Max(0.45,0.16) ⟶ 0.45. The result of this step is a number for each rule (i.e. the degree of consistency between the inputs and each rule's antecedent).
2. Reshape the original consequent of each rule (which is a fuzzy set), given the degree of consistency between the inputs and the rule's antecedent. The result of this step is a (reshaped) fuzzy set for each rule. Possible operators for the reshaping method are Truncate (by default) and Multiplication. Consider, for example, the rule at the top. Its original consequent is the fuzzy set "Good suitability" with membership function μGood Suitability(x) . The computation would be: μReshaped Good Suitability(x) Truncate(μGood Suitability(x),0.45) Min(μGood Suitability(x),0.45) .
3. Aggregate all the reshaped consequents. The result of this step is one fuzzy set (labeled "Aggreg. Suitability"), which is the union of all the reshaped consequents. Possible operators for the aggregation are the Max, the probabilistic sum (ProbOr[a,b]:=a+b-ab) and the sum clipped at 1 (ClippedSum).
4. Defuzzify the aggregated fuzzy set. The defuzzification reduces the aggregated fuzzy set to one single number. Possible defuzzification methods are: center of gravity (COG), first of maxima (FOM), last of maxima (LOM), middle of maxima (MOM) and mean of maxima (MeOM).
If you want to use Mamdani (or max-min) inference, choose "Min" for logical AND, "Max" for logical OR, "Truncate" as "Reshaping method"," Max" as "Aggregation method", and "COG" as "Defuzzification method".
[1] G. J. Klir and B. Yuan, Fuzzy Sets and Fuzzy Logic: Theory and Applications, Upper Saddle River, New Jersey: Prentice Hall PTR, 1995.


    • Share:

Embed Interactive Demonstration New!

Just copy and paste this snippet of JavaScript code into your website or blog to put the live Demonstration on your site. More details »

Files require Wolfram CDF Player or Mathematica.

Mathematica »
The #1 tool for creating Demonstrations
and anything technical.
Wolfram|Alpha »
Explore anything with the first
computational knowledge engine.
MathWorld »
The web's most extensive
mathematics resource.
Course Assistant Apps »
An app for every course—
right in the palm of your hand.
Wolfram Blog »
Read our views on math,
science, and technology.
Computable Document Format »
The format that makes Demonstrations
(and any information) easy to share and
interact with.
STEM Initiative »
Programs & resources for
educators, schools & students.
Computerbasedmath.org »
Join the initiative for modernizing
math education.
Step-by-Step Solutions »
Walk through homework problems one step at a time, with hints to help along the way.
Wolfram Problem Generator »
Unlimited random practice problems and answers with built-in step-by-step solutions. Practice online or make a printable study sheet.
Wolfram Language »
Knowledge-based programming for everyone.
Powered by Wolfram Mathematica © 2018 Wolfram Demonstrations Project & Contributors  |  Terms of Use  |  Privacy Policy  |  RSS Give us your feedback
Note: To run this Demonstration you need Mathematica 7+ or the free Mathematica Player 7EX
Download or upgrade to Mathematica Player 7EX
I already have Mathematica Player or Mathematica 7+