Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

COMP4033

Fuzzy Logic and Fuzzy Systems

Question1:

a.

There are some problems that can be easily divided into True” or False”, “1” or “0” . In terms of human gender, “1” can represent male and “0” can represent female.

 

But in real life, many problems cannot be well explained by this classical 2-valued logic. For example, when we talk about whether the temperature in the room is cold or not, different people have different definitions of cold. At 15 degrees Celsius, some students feel a little cold, but the other students think it is a nice temperature. So we cannot answer the question of whether the room is cold with “1” and “0” . But if we use fuzzy logic, the answer can be described as “0. 1 cold” or “0.7 cold” .

b.

Fuzzy set is a special set which is different from the set in Mathematics. The characteristic function is replaced by a membership function that gives each element a degree of membership in [0, 1].

 

The discrete sets could be written as

 

,

where     is the degree of membership for each member     of set A.

And the continuous fuzzy set A is written as

 

.

c.

“The truth value that bottle X is full’ is 0.5” means the degree of fullness of bottle X is 0.5, and bottle X could be a bottle half full of water. The 0.5 here is a fuzzy membership value. “The probability that bottle Y is full’ is 0.5” means there is 0.5 chance bottle is full, and 0.5 chance the bottle is not full.

If we use fuzzy set theory to talk about the fullness ofbottle, an empty bottle could be “0.0 full”, a partially-full bottle could be “0.5 full” and the full bottle could be “1.0 full” . When it comes to the probabilities, 1.0 full means the bottle is a full bottle, 0.0 full means this bottle is partially- full or empty.

 

d.

A linguistic variable is a linguistic expression that contains some fuzzy sets as terms to explain a concept. There is a linguistic variable Temperature with 4 terms (hot, warm, cold, frozen), and the universe of discourse is [0,40].


 

 

i. When temperature is 35℃, the degree of hot is 0.5 that is a partial membership.

 

ii. When temperature is 18℃ the membership of cold is 0.7 and the membership of warm is 0.3, so this element be a member of more than one set.

 

e.

T-norm is a kind of binary operation that can be used to calculate fuzzy intersections, and t- conorm is the binary operation to calculate fuzzy unions.

The membership function A and B shown as below.

 

The orange line shows the result of standard t-norm (min(a, b)) and product t-norm (ab).

 

The blue line shows the result of standard t-conorms (max(a, b)) and probabilistic sum t- conorms (a + b - ab).

 

 

Question 2:

a.

Inputs: Code=6, Report=7, Engagement=3

 

Rule1: IF Code is  poorc   OR Report is  poorr   OR Engagement is  poore , THEN Grade is low

Antecedent1: Code is  poorc   →  µpoorc(6) = 0

Antecedent2: Report is  poorr   → µpoorr(7) = 0

Antecedent3: Engagement is  poore   →  µpoore(3) = 0.4

Rule strength: Antecedent1 OR Antecedent2 OR Antecedent3→ max(0,0,0.4) = 0.4

Consequent: Grade is low with the strength →low ∩ strength

µlowstrength   = min(µlow(y),  µstrength(y))

 

low: 1.0/0 + 0.9/1 + 0.8/2 + 0.5/3 + 0.3/4 + 0. 1/5

strength: 0.4/0 + 0.4/1 + 0.4/2 + 0.4/3 + 0.4/4 + 0.4/5

low strength: 0.4/0 + 0.4/1 + 0.4/2 + 0.4/3 + 0.3/4 + 0.1/5

 

Similarly, the results of other rules could also be calculated.

 

Rule2: min(µaveragec(6),  µaverager(7),  µaveragee(3)) = min(0.8, 0.5, 0.5) = 0.5 medium ∩ strength: 0.1/2 +0.3/3 + 0.5/4 + 0.5/5 + 0.5/6 + 0.3/7 + 0.1/8

 

Rule3: min(µgoodc(6),  µgoodr(7),  µgoode(3)) = min(0. 1, 0.4, 0) = 0

high ∩ strength: = 0/5 + 0/6 + 0/7 + 0/8 + 0/9 + 0/10

 

Rule4: min(µgoodc(6),  µaverager(7)) = min(0. 1, 0.5) = 0.1

medium ∩ strength: = 0.1/2 +0.1/3 + 0.1/4 + 0.1/5 + 0.1/6 + 0.1/7 + 0.1/8

 

Rule5: min(µgoodr(7),  µaveragee(3)) = min(0.4, 0.5) = 0.4

medium strength: = 0.1/2 +0.3/3 + 0.4/4 + 0.4/5 + 0.4/6 + 0.3/7 + 0.1/8

 

Rule6: min(µaveragec(6),  µaverager(7),  µgoode(3)) = min(0.8, 0.5, 0) = 0

high ∩ strength: 0/5 + 0/6 + 0/7 + 0/8 + 0/9 + 0/10

 

The result of Mamdani inference is R1 R2R3 R4R5 R6:

0.4/0 + 0.4/1 + 0.4/2 + 0.4/3 + 0.5/4 + 0.5/5+ 0.5/6 + 0.3/7 + 0.1/8 + 0/9 + 0/10

 

b.

Centre of Gravity: calculate the weighted average of the shape to find a balance point.

 

Xg= (0.4*0 + 0.4*1 + 0.4*2 + 0.4*3 + 0.5*4 + 0.5*5+ 0.5*6 + 0.3*7 + 0.1*8)/ (0.4 + 0.4 + 0.4 + 0.4 + 0.5 + 0.5+ 0.5 + 0.3+ 0.1) = 3.657143

 

Mean of Maxima (MOM): Select all the x that correspond to the maximum membership, and take the average of these x.

 

Xm= mean(4,5,6) = 5

 

c.

Consider there are two fuzzy set:

 

A: 0.2/0 + 0.4/1 + 0.4/2 + 0.4/3 + 0.5/4 + 0.5/5+ 0.5/6 + 0.3/7 + 0. 1/8 + 0. 1/9 + 0. 1/10

B: 0.1/0 + 0.4/1 + 0.4/2 + 0.5/3 + 0.5/4 + 0.5/5+ 0.5/6 + 0.5/7 + 0.4/8 + 0.3/9 + 0. 1/10 By using Mean of Maxima, the defuzzification results of both A and B are 5.

XmA   = mean(4,5,6) = 5

XmB   = mean(3,4,5,6,7) = 5

 

The results above  show that numeric defuzzification could leads to the loss of graphical information. We can use other criteria together to describe the characteristics of the output .

 

i. Normalized Area

 

 

ii. Fuzzy Entropy

 

 

iii.  µg: Membership degree of defuzzification point that represents the confidence of the result.

 

iv.  µh: The maximum value of the entire membership function that is also the maximum value of rule strength.


 

Question 3:

a. To change this system to a TSK fuzzy inference system, the membership function type of output sets should be singleton, which is a vertical line. The antecedent evaluation is as same as Mamdani, but the implication operation should be adjusted to prod” . This system no longer requires defuzzification, because the output will become to a crisp number according to the formula:

 

where k is the parameters in consequents and w is firing strength (truth) of each rule. The processing of this TSK fuzzy inference system is shown as the picture.

 


b.

In first-order TSK inference, the consequent function of Rule i becomes to z =  pix +  qiy +  ri that is a moving singleton’ . These singletons move linearly in the output space and are then combined to form the final output.

 

Compared with the output surface of zeroth-order TSK inference, the surface of first-order is smoother, but the overall trend has not changed.

 

Assume there is a plane Output = Input1 + Input2, the surface of first-order TSK is roughly equal to the combination of the surface of zeroth-order TSK and the plane. The p and q in rules could adjust the incline of surface.

 

c.

Mamdani and TSK are very different in terms of structure and performance.

 

i. Rule Evaluation

 

After getting the rule strength, if we are using TSK, we only need multiply rule strength and the output set (a single line for 0th order). In terms of Mamdani, we need to take the intersection (or other implication operation) of the entire set.

 

ii. Rule Combination

 

For TSK, we simply sum the results of the different rules directly and divide it by the sum of rule strengths. For Mamdani, we need apply the aggregation operation to all rule result set.

 

iii. Defuzzification

 

There are numeric defuzzification and linguistic defuzzification for Mamdani, whereas there is no  need  to  defuzzy  for  TSK  (or  we  can  treat  the  calculation  in  rule  combination  as defuzzification).

 

It is clear that using TSK will bring easy calculations, which makes it very efficient. For TSK FIS, the parameters in that could be optimized by using ANFIS, and its output surface is continuous. So TSK is suitable to work with linear techniques, optimization and adaptive techniques.


Question 4:

a.

i. The structure of a fuzzy model includes the number of input and output variables, the number of terms, the types of membership function, the content of rules, etc.

 

ii. The parameters of a fuzzy model can be adjusted to get an optimal model. These parameters contain the precise parameters of each membership function, weights of rules, defuzzification parameters, etc.

 

iii. For direct objective functions, we need to assume the output target of the system and give some sample input-output pairs so that the cost of model could be calculated and we can tune the parameters.

 

For indirect objective functions, we do not have a certain criterion to measure the output error. For example, the output of shares fuzzy inference system is Advice with three terms (Sell, Hold, Buy). It is hard to say whether the result of advice is good or not, there is not a correct value. To solve this problem, we need another indirect objective function to calculate the change of total value of cash and stock holdings over a period of time.

 

b.

Assume there is a fuzzy inference system with 2 input variables (number of rooms, number of occupiers) and 1 output variable (smart meter readings), and the historical data can be used to train this model. The target of tuning is to adjust the parameters of parameterized membership functions to minimize the cost function. There are different methods to tune the model:

i. Exhaustive-search

 

Try all possible combinations of parameters. Assume there are 2 parameters A and B of, both of them are integers between 1 and 10. From (1,1) to (1,10), from (2,1) to (2,10), …… (10,1) to (10,10), there are a hundred combinations in total. The optimal parameters can be obtained by calculating the loss function in each case. However, this approach is inefficient and cannot be applied to complex models.

 

ii. Monte-Carlo search

 

First, an initial position is randomly generated and the output of that position is recorded as the optimal value. Next, generate another random position and evaluate it. If the new position is better than the best found so far store the new position as the best. The new position is repeatedly generated until the stop condition is reached (the best position is not updated after a certain number of repeats). This approach may not find a global maximum.

 

iii. Hill-climbing


 

First, generating a random initial position and evaluate it. Then, evaluate all the surrounding positions around it and move in the direction of maximum improvement. If moves in all directions fail to find a better position, stop moving. This approach may not find a global maximum, too.

c.

There are 4 inputs variables (engine size, fuel consumption, number of seats, and price) in this fuzzy inference system, each of them contains some membership functions, and the parameters in it can be adjusted in Layer 1 of ANFIS. In Layer 2, there are a lot of nodes that represent different rules, so it is necessary to know rules of this system. Normalized Firing is taking place in Layer 3. Next, in Layer 4, there are some calculations between weights and consequent parameters. Finally, all normalized rule outputs are summed up in Layer 5, and the result can help us to classify aircraft. The types of aircraft should be represented as {1,2,3,4}.

 

There are 2 passes in ANFIS learning. In backward pass, the parameters in membership functions are tuned by using a gradient descent tuning algorithm. In forward pass, parameters of consequent functions modified by using an iterative least squares estimation.

 

Compared to ANFIS, manually creating a Mamdani is cumbersome. All the parameters of the function need to be defined with an appropriate value by ourselves, according to the range of actual  training  data.  ANFIS  approach  automatically  adjusts  parameters  and  has  high performance in terms of RMSE. ANFIS also can be used to tune a manual FIS.