Fuzzy Sets and Systems 64 (1994) 207-212 North-Holland
207
A least squares model for fuzzy rules of inference T . D . P h a m a n d S. V a l l i a p p a n
and
School of Civil Engineering, University of New South Wales, Kensington NSW 2033, Australia
pl: If X is A then Y is B p2: Y i s n o t B
Received January 1993 Revised July 1993
Conclusion: X is not A
Abstract: In this paper, the method of least squares which uses the power function is applied to the fuzzy inference rules. These rules, in fuzzy logic, are known as the 'generalized modus ponens' and the 'generalized modus tollens'. The proposed technique gives reasonable evaluations for fuzzy consequences and is simple for computer applications.
Keywords: Fuzzy logic; fuzzy inference rules; generalized modus ponens; generalized modus tollens, least squares model; power function; computer applications.
(MT)
(2)
where pl and p2 are premises 1 and 2 respectively, and the unbroken line is used to separate the premises from the conclusion. In fuzzy logic, exact reasoning can be extended to approximate reasoning which deals with the inherent vagueness of human language. Thus, the generalized modus ponens (GMP) and the generalized modus tollens (GMT) are introduced to reach a conclusion from fuzzy premises. These rules can be expressed in standard form as follows. pl: I f X i s A t h e n Y i s B p2: X is A'
1. Introduction Conclusion: Y is B' When a logical inference is made, in general, a conclusion is deduced from a hypothesis. On the other hand, a logical argument involves a set of propositions where the conclusion is claimed to follow from the evidence. The two well-known methods of the inference principle in two-valued logic are the modus ponens (method of affirming the antecedent) and the modus tollens (method of denying the consequent). Modus ponens (MP) and modus tollens (MT) may be expressed in an If-Then form as
pl: I f X i s A t h e n Y i s B p2: X is A Conclusion: Y is B
(MP)
(1)
Correspondence to: Prof. S. Valliappan, School of Civil Engineering, University of New South Wales, P.O. Box 1, Kensington NSW 2033, Australia.
(GMP)
(3)
and pl: I f X i s A t h e n Y i s B p2: Y is B' Conclusion: X is A'
(GMT)
(4)
where A and A' are the fuzzy sets in a universe of discourse U; and X is a variable which takes values in U. The membership functions of A and A' are written as #a(U) and #a,(U) respectively. Similarly, B and B' are the fuzzy sets in a universe of discourse V; and Y is a variable taking values in V. The membership functions of B and B' are denoted as #B(v) and #B,(v) respectively. It is noted that in (3) when A' = A, and in (4) when B '= not B, then the generalized modus ponens and the generalized modus tollens reduce to the cases of the modus ponens and the modus tollens respectively.
0165-0114/94/$07.00 © 1994---Elsevier Science B.V. All rights reserved SSD1 0165-0114(93)E0242-K
T.D. Pham, S. Valliappan / A least squares model
208
For the fuzzy inference rules, different methods have been suggested by various authors such as Zadeh [4,5], Fukami et al. [2], Mizumoto and Zimmermann [3], and Ezawa and Kandel [1]. These methods will be outlined as follows. Zadeh's method [4, 5]. On the formulation of the basic rules of inference in fuzzy logic, Zadeh suggested the compositional rule of inference and the generalized modus ponens whose expressions are given as follows: (a) Compusitional rule. X isA
ponens and the generalized modus tollens. The inference approach is similar to that as discussed in [2]. Ezawa and Kandel's method [1]. The homomorphic fuzzy modus ponens (h-FMP) and the homomorphic fuzzy modus tollens (h-FMT) are suggested for fuzzy implications which include subnormal and discrete fuzzy sets. These inference rules also need some necessary criteria for the inference schemes.
2. Fuzzy inference using a least square model
(X, Y) is R Then Y is A oR.
(5)
R is the binary relation of X and Y whose dual membership function is I~R(U,V), and the operation A oR is the composition of A and R and defined as
['~AoR= sup(~A(u) A btn(U, V))
(6)
u
where sup denotes supremum (the least upper bound), and ^ stands for minimum. (b) Generalized m o d u s ponens. The inferred membership function for the membership B' as described in (3) is defined by B' = A' o ( - A (~ B)
(7)
where - A is the negation of A, and its membership function is calculated as ~--A(U)= 1 -- I~A(U). The bounded sum is given as follows:
U--A(~gB(U, V) = 1 ^ (1 - ~A(U) "~ ~B(U)).
(8)
Fnkami et ai.'s method [2]. Fukami et al. suggested several relational criteria for fuzzy conditional inference, and introduced the new expressions for each type of the fuzzy relations. The criteria are established to reach the conclusions when the second premises are allowed to include various linguistic terms such as very, more or less and not. Mizumoto and Zimmermann's method [3]. Based on the early development in [2], Mizumoto and Zimmermann introduced further fuzzy relations for the generalized modus
Zadeh [6, 7] has introduced the operations of several linguistic hedges to convey a better understanding of human language. The operators of such hedges as very, more or less, highly, plus and minus are expressed in terms of the power functions. Thus, taking advantage of these properties, a method for fuzzy rules of inference is proposed as follows: (i) Introduce a function ItA,(U) in terms of IZa(U) in order to obtain the coefficients of the relation between ~.~A,(U) and ~.~A(U). (ii) These coefficients of relation can be passed to/in(v) for the inference of t~B,(v). Steps (i) and (ii) can be achieved by means of the least squares method applied to power functions which pass discrete membership functions through their sets of data points (/zi, xi) fori=l,...,n, inaform (9)
I~(X) = ax °.
For a discrete fuzzy set of n ordered pairs {l~l/xl + l~2/Xz + • • • + I~,,/x,,}, the constants a and b can be determined by solving the two simultaneous, linear algebraic equations: n In a +
In x~ b = .= t 1
In ~ ,
(10)
i=1
(i~=llnXi)lna+(~=l(lnxi)2)b
= ~ (lnxi)(ln/~i).
(11)
i=1
Using the form of (9), the discrete membership functions of the fuzzy sets A and A' can be
T.D. Pham, S. Valliappan / A least squares model
approximated in terms of the power function by
/.ta(U ) = at/b
209
Therefore,
(12)
~A,(U) = 1 --[C3(~A(u))C4].
(13)
3. Illustrations
(22)
and
~ta,(u ) = a 'u °',
where a, b, a' and b' are the constants of the power functions. Equation (12) can be rearranged as u = \--7--/
"
(14)
From (13) and (14), I~A,(U) can be expressed in terms of/*A(U) as follows: pa,(u) = C,(ItA(U)) c2
(15)
where
C1
a' (a)b,/b
and
C2
b' b
On the basis of the relation between I~A(U) and I~A,(U) as defined in (15), the membership function of B' can be inferred by u.,(v)
=
C'-.
(16)
A few examples have been provided to illustrate the proposed method. A computer program has been written in Fortran 77L for the generalized modus ponens and' the generalized modus tollens using the power function as a least squares model. The program requires a prepared data file containing the membership functions of A, A' and B for modus ponens, or A, B and B' for modus tollens, together with their numbers of ordered pairs in a certain format. If any single value of the ordered pairs is zero, then it will be set to 0.0000001 to validate the natural logarithm calculation. The computer will recognize if it is the case of modus tollens by the signs of the constants h and h'. If they are of opposite signs which indicates that one is a decreasing function (d~u/dv<0) and the other is an increasing function (d/~/dv > 0 ) , it is the modus tollens. The computer program is included in the Appendix.
It can be noted that the above steps are applicable to the case of generalized modus ponens. Considering the case of genealized modus tollens by setting
Consider the following fuzzy sets which are taken from Example 1 in [2]:
Its(v) = g v a
u~X,
(17)
and
v~Y,
X=Y
I~,,(v) = g'v h'
(18)
where g, h, g' and h' are the constants of the power functions. Let Un,(v) = 1 - ~uw,(v)
(19)
and also express #B,, in form of a power function: (20)
~B" = g "vh''
From (17)-(20): t,,,,(,,)
3. i. Cases of generalized modus ponens
A ( u ) = small = 1/0 + 0.8/1 + 0.6/2 + 0.4/3 + 0.2/4,
B ( v ) = middle = 0.2/2 + 0.4/3 + 0.8/4 + 1/5 + 0.8/6 + 0.4/7 + 0.2/8. (a) Let A'(u) = small, the conclusion will be
B ' ( v ) = 0.2/2 + 0.4/3 + (}.8/4 + 1/5 + 0.8/6
= 1 - [c3(t,,,(o))ql
(21)
+ 0.4/7 + 0.2/8
= middle = B(v).
where g" C3=(g)h,/h
=0+1+2+3+4+5+6+7+8+9+10,
and
h" C4=~.
(b) If A ' ( u ) = very small = AZ(u):
A ' ( u ) = 1/0 + 0.64/1 + 0.36/2 + 0.16/3 + 0.04/4.
T.D. Pham, S. Valliappan / A least squares model
210
Then the inferred fuzzy set B ' ( v ) is B ' ( v ) = 0.04/2 + 0.16/3 + 0.64/4 + 1/5
+ 0.64/6 + 0.16/7 + 0.04/8 = very middle = BZ(v).
Thus, A ' ( u ) = 0/0 + 0.11/1 + 0.23/2 + 0.37/3 + 0.55/4 = n o t m o r e or less s m a l l = - A ° 5 ( u ) .
(d) Let B ' ( v ) = n o t v e r y very m i d d l e ------ - B 4 ( v ) :
(c) Let A'(u) = m o r e or less s m a l l = A° 5(u): A ' ( u ) = 1/0 + 0.89/1 + 0.77/2 + 0.63/3 + 0.45/4.
The consequence is calculated as B ' ( v ) = 0.45/2 + 0.63/3 + 0.89/4 + 1/5
+ 0.89/6 + 0.63/7 + 0.45/8 = m o r e o r less m i d d l e = B ° 5 ( v ) .
(d) If A ' ( u ) = v e r y v e r y s m a l l = A a ( u ) : A'(u)
=
1/0 + 0.41/1 + 0.13/2 + 0.03/3 + 0.002/4.
Then a'(v)
=
0.002/2 + 0.03/3 + 0.41/4 + 1/5 + 0.41/6 + 0.03/7 + 0.002/8.
= v e r y v e r y m i d d l e = B4(v). 3.2. Cases o f g e n e r a l i z e d m o d u s toUens
Using the same fuzzy sets as given in the Example in [2], and letting (a) B ' ( v ) = n o t m i d d l e = - B ( v ) : B ' ( v ) = 0.8/2 + 0.6/3 + 0.2/4 + 0/5
+ 0.2/6 + 0.6/7 + 0.8/8. Then A'(u) = 0/0 + 0.2/1 + 0.4/2 + 0.6/3 + 0.8/4 = not small = -A(u).
(b) B'(v) = n o t v e r y m i d d l e = ~B2(v): B ' ( v ) = 0.96/2 + 0.84/3 + 0.36/4 + 0/5
+ 0.36/6 + 0.84/7 + 0.96/8. This yields the fuzzy conclusion as follows: A'(u) = 0/0 + 0.36/1 + 0.64/2 + 0.84/3 + 0.96/4 = n o t v e r y s m a l l = -A2(u).
(c) B ' ( v ) = n o t m o r e or less m i d d l e
B ' ( v ) = 0.99/2 + 0.97/3 + 0.59/4 + 0/5
+ 0.59/6 + 0.97/7 + 0.99/8. Then the consequence is A ' ( u ) = 0/0 + 0.59/1 + 0.87/2 + 0.97/3 + 0.99/4 = not very very small = ~ma(u).
5. Conclusion Fukami et al. [2], and Mizumoto and Zimmermann [3] have pointed out that the rules of inference proposed by Zadeh [4-6] do not always give reasonable consequences. However, the methods introduced by them in [2, 3] involve several fuzzy relation operators, and they obviously lack generalization. The monotone fuzzy implication which is introduced by Ezawa and Kandel [1] is also subjected to a constraint that the membership function of the fuzzy set B must be a subset of the membership function of the fuzzy set A; otherwise reasonable consequences are hardly inferred. Ezawa and Kandel [1] also suggested that it would be worth considering the fuzzy inferences based on other compositional rules than the classical max-min composition. This paper has discussed a new method for two basic inferences in fuzzy logic, which even departs from the composition operation as being used in many techniques. The advantage of this proposed method is that it can be generally applicable when the membership functions in the premises are characterized by the fuzzy linguistic hedge operators as defined by Zadeh [5-7]. The mathematical operations on the generalized modus ponens and the generalized modus tollens are simple and convenient for computer implementation.
Appendix
=
B ' ( v ) = 0.55/2 + 0.37/3 + 0.11/4 + 0/5
+ 0.11/6 + 0.37/7 + 0.55/8.
Computer Program for Generalized Modus Ponens and Generalized Modus Tollens using Power Function for Least Squares Method
T.D. Pham, S. Valliappan / A least squares model
PROGRAM FUZZY_INFERENCE C C C C C
C C C
C
C
80 C
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
FUZZY INFERENCE USING LEAST SQUARE TECHNIQUETHE POWER FUNCTION .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
DIMENSION X(50), Y(50), Y3(50), Xl(50), Y1(50), X2(50), Y2(50) CHARACTER*20, IN, OUT, TITLE C O M M O N / F I L E S / J I N , JOUT COMMON NEG LOGICAL NEG PRINT *,'ENTER INPUT-FILE:' READ (*, *) IN PRINT *,'ENTER OUTPUT-FILE:' READ (*, *) OUT PRINT *,'ENTER TITLE:' READ (*, *) TITLE NEG = .FALSE. JIN = 1 JOUT = 2 OPEN (JIN, FILE = IN) OPEN (JOUT, FILE = OUT) REWIND 1 REWIND 12 WRITE(2, *) TITLE READ (1, *) Calculate a&b or a'&b' for A or B. CALL POWER (A1, B1, X1, Y1, N1) Calculate a'&b' for A'. CALL POWER (A2, B2, X2, Y2, N2) Check if fuzzy modus tollens IF(B1 .LT. 0 . . A N D . B2 .GT. 0 . . O R . & B1 .GT. 0 . . A N D . B2 .LT. 0.) THEN NEG = .TRUE. CALL COMPLMT (Y2, N2) Calculate g"&h" CALL POWER (A2, B2, X2, Y2, N2) WRITE(2, *) 'Fuzzy Modus Tollens' ELSE WRITE(2, *) 'Fuzzy Modus Ponens' ENDIF Read membership grades of B or A. READ (1, *) READ (1, *) N3 DO 80 I = 1, N3 READ (1, *) X(I), Y(I) CONTINUE Inferring membership function B' or A'. B3 = B2/B1 A3 = A2/(AI**B3)
211
WRITE (2, *) 'The Inferred Membership Function is :' DO 90 I = 1, N3 Y3(I) = A3*Y(I)**B3 IF (NEG) THEN Y3(I) = 1.-Y3(I) ENDIF WRITE (2, 100) V3(I),'/', X(I) 90 CONTINUE 100 FORMAT(F5.3, 1X, A, 1X, F7.3) STOP END SUBROUTINE POWER (A, B, X, Y, N) DIMENSION X(50), Y(50), XL(50), YL(50) C O M M O N / F I L E S / J I N , JOUT COMMON NEG LOGICAL NEG SX = 0. SY = 0. SXX = 0. SXY = 0. IF (NEG) GOTO 25 READ (JIN, *) READ (JIN, *) N DO 20 I = 1, N READ (JIN, *) X(I), Y(I) 20 CONTINUE 25 DO 3 0 I = I , N IF(X(I).EQ.0.) X(I) = 0.0000001 IF(Y(I).EQ.0.) Y(I) = 0.0000001 XL(I) = LOG (X(I)) YL(I) = LOG (Y(I)) SX = SX + XL(I) SY - SY + YL(I) SXX = SXX + (XL(I)*XL(I)) SXY = SXY + (XL(I)*YL(I)) 30 CONTINUE C1 = ( S X Y * S X ) - (SXX*SY) C2 = (SX*SX) - (SXX*N) AL -- C1/C2 A = EXP(AL) a = (SY - (N*AL))/SX RETURN END SUBROUTINE COMPLMT (Y, N) DIMENSION Y(50) DO 10 I = 1, N Y(I) = 1. - V(I) 10 CONTINUE RETURN END
212
T.D. Pham, S. Valliappan / A least squares model
Acknowledgements This p a p e r f o r m s a part o f the o n g o i n g research on fuzzy-set t h e o r y applied to the uncertainty m o d e l i n g of engineering p r o b l e m s u n d e r the direction o f Prof. Valliappan. T h e authors a c k n o w l e d g e the financial s u p p o r t received f r o m the A u s t r a l i a n R e s e a r c h Council.
References [1] Y. Ezawa and A. Kandel, Robust fuzzy inference, Int. J. Intelligent Systems 6 (1991) 185-197.
[2] S. Fukami, M. Mizumoto and K. Tanaka, Some considerations on fuzzy conditional inference, Fuzzy Sets and Systems 4 (1980) 243-273. [3] M. Mizumoto and H.-J. Zimmermann, Comparison of fuzzy reasoning methods, Fuzzy Sets and Systems 8 (1982) 253-283. [4] L.A. Zadeh, Fuzzy logic, IEEE Computer, April (1988) 83-93. [5] L.A. Zadeh, The concept of a linguistic variable and its application to approximate reasoning. Part III, Information Sciences 9 (1975) 43-80. [6] L.A. Zadeh, The concept of a linguistic variable and its application to approximate reasoning. Part II, Information Sciences 8 (1975) 301-357. [7] L.A. Zadeh, A fuzzy-set theoretic interpretation of linguistic hedges, J. Cybernetics 2 (1972) 4-34.