Strategy testing system
Test before you invest


 

 
  Home Downloads Licensing Contact

 

Fuzzy Logic Fundamentals

Fuzzy logic is a relatively new discipline that gained rapid acceptance in the fields of systems control and decision support.  It is especially useful where the relationship of variables may be ambiguous or unknown.  There are several reasons for this, one is that traditional logic is rigid and doesn't incorporate nuances well.  For example, a statement like "is x greater than .75" is either true or it is not true.  Fuzzy logic is more flexible.  It uses statements like "x is high", where the amount it is high is further described mathematically by a membership function.  The degree of membership varies from 0 to 1.0.

A family of related membership functions is called a fuzzy set.   An example of a set with two functions is shown below.  One function describes membership in the "negative" set and the other in the "positive" set.  The example shows how a variable value of .2 results in the outputs where the confidence (i.e., membership) in the statement “MACD is Negative” is roughly .26 and confidence in the statement “MACD is Positive” is about .7.  In fuzzy logic the .2 input value is called a "crisp" value and the memberships "fuzzy" values.

 

 

Another departure from traditional set theory in the way unions (OR's) and intersections (AND's) are calculated.  The probabilistic AND used in traditional theory is the result of multiplication of memberships.  So the results of a long series of AND's approaches zero, even if all independent probabilities are high.  In fuzzy logic the result of an intersection is the minimum of the joined AND's and so results in selection of the minimum value in the collection (which may be zero, but is not near zero just because of the number of conditions combined). Similarly, probabilistic OR membership is the probability of A plus the probability of B minus the probability of A and B, which approaches 1, whereas the results of a fuzzy union is the maximum membership of the union.  In practice both probabilistic and fuzzy joins are used.

Fuzzy logic rules take the form of IF x THEN y where the x condition is known as antecedent and the y as the consequence.  An example that mimics the buy/sell rules of a moving average crossover might be:

        IF MACD Is Positive THEN Signal Is Buy.

The antecedent can also express multiple conditions.  For example:

        IF MACD Is Low AND MACDh Is Positive AND NOT Stochastic %K Is Low THEN Signal Is Buy

The combining of the memberships of each of the elements in the antecedent (unions and intersections) results in the confidence in the consequence.

The last step in the inference process is to “defuzzify” fuzzy values back into a single crisp value.  This is done through another set of fuzzy functions.  The process is essentially the reverse of fuzzification as it generates a value that is the weighed result of the membership values.  Fuzzy logic practitioners have devised several methods of defuzzification.  One of the most common, the MaxMean method, returns the mean value of the function with the maximum membership.  In the example shown below it would be the average of the area shaded green.   Another, the Centroid method, returns the center-of-gravity of both the green and red shaded areas taken together.  The Centroid method produces a smoother response, which is why it is commonly used in control systems.  However, the two methods will usually produce similar results in a decision support application.

    

 

Back