“As far as the laws of mathematics refer to reality, they are not certain. And as far as they are certain, they do not refer to reality.”—Albert Einstein
Einstein’s observation about math and reality raises the question of just how well math and science describe the world. Math and science are logical and organized, and they describe the world in the same way. They try to fit every process and phenomenon into their equations and precise rules. But the world we live in is messy, uncertain, often ambiguous and rarely black and white. Thanks to math and science, we have observed and quantified physical tendencies and relationships that have proved to be powerfully predictive and that we have been able to define through mathematical logic and describe through scientific laws. But the truth of this logic and these laws is only a matter of degree and could change at any moment.1 As Scottish philosopher David Hume once noted, just because the sun has always risen doesn’t necessarily mean it will do so tomorrow. This level of “grayness” is the key idea behind the development of fuzzy logic theory, which can increasingly be found in many engineering and scientific applications today.
The theory of fuzzy logic is based on the notion of relative membership grades and inspired by processes of human perception and cognition that are uncertain, imprecise, partially true or lacking in sharp boundaries. Fuzzy logic allows for the inclusion of vague human assessments in computing problems. It also provides an effective means for conflict resolution of multiple criteria and a better assessment of options. New computing methods based on fuzzy logic can be used in the development of intelligent systems for decision making, identification, pattern recognition, optimization and control.
Indeed, fuzzy logic, once thought to be an obscure mathematical curiosity, can be found in many engineering and scientific applications. It has been used in facial pattern recognition, air conditioners, washing machines, vacuum cleaners, transmissions, power systems, weather forecasting, models for new-product pricing or project risk assessment, medical diagnosis and treatment plans, and autonomous systems such as self-driving cars.
Fuzzy logic has also been used in machine learning, an aspect of artificial intelligence (AI) in which we help computers gain knowledge and learn how to perform tasks. Machine learning can be supervised learning, where we know both the inputs and the outputs, or unsupervised learning, where we don’t know the outputs and need to identify patterns and make groups. Fuzzy logic falls into the category of unsupervised learning methods. It is applicable to machine learning because it provides multivalued answers.2
In machine learning, clustering involves grouping objects that are similar. Fuzzy logic can be used to determine so-called fuzzy clusters, in which each data point can belong to more than one cluster. (A hard cluster exists when a data point belongs only to a single cluster.) Fuzzy variables in machine learning denote the degree of membership of a given data point in the cluster’s search space. In other applications, fuzzy decision trees can be used in machine-guided decision making by applying a number of fuzzy rules simultaneously. Such an approach makes more sense with fuzzy rules than with standard bivalent — that is, true or false — rules. Fuzzy decision trees resemble standard decision trees, but the options at each branching point are managed using fuzzy, rather than bivalent, logic.
Replacing standard decision trees with fuzzy ones allows the use of smaller trees with fewer leaves and internal nodes to encapsulate a richer amount of information.
What Is Fuzzy Logic?
The concept of fuzzy logic was introduced by Lotfi Zadeh of the University of California, Berkeley, in the 1960s.3 Zadeh was working on the problem of helping computers understand natural language, which, like many other human activities, is not easily translated into absolute terms of 0 and 1. (Whether everything is ultimately describable in binary terms is a philosophical question worth pursuing. In practice, much of the data we might want to feed into a computer exists in in-between states. The same frequently applies to the results of computing.) It may help to see fuzzy logic as the way human reasoning normally works, with binary and Boolean logic as special cases.
In fuzzy logic, 0 and 1 are extreme cases of truth (or fact) and encompass various states of in-between truth, so that, for example, at 72 inches, or six feet, a man’s height would not be “tall” or “short” but “25 percent of tallness,” with a 0.25 membership grade. The concept of membership grade is important in fuzzy logic, quantifying where a single data point lies within a fuzzy set, in which 0 means it is not a member of that set and 1 that it is fully a member.
Fuzzy logic seems closer to the way our brains actually work. We aggregate data and form a number of partial truths that we aggregate further into higher truths, which, when certain thresholds are exceeded, trigger results such as motor reactions. A similar kind of process can be found in neural networks, expert systems and other AI applications. Fuzzy logic is essential to the development of humanlike capabilities for AI, sometimes referred to as artificial general intelligence: the representation of generalized human cognitive abilities in software so that the AI system can find a solution when it faces an unfamiliar task.
Why Fuzzy Logic?
In all domains, from marketing to engineering, we need to deal with uncertainty in order to solve problems and make decisions. Fuzzy logic is a system that helps us do all of these things better by programming machines to think as humans do. It may not give us accurate reasoning, but it provides us with acceptable reasoning.
Fuzzy logic accepts that we are unable to provide a precise number for many uncertainties in life. Information is often imperfect, and data has errors. By replacing binary either/or options with if/then possibilities, fuzzy logic expands choices and considers subjective attributes.
The basis of fuzzy logic is also the basis of human communication. Because fuzzy logic is built on structures of qualitative description used in everyday language — what’s known as linguistic variables, such as “short,” “medium” or “tall” in the height example — it is easier to understand. Moreover, because the mathematical concepts behind fuzzy reasoning are relatively simple, it represents an intuitive approach without far-reaching complexity.
A fuzzy logic system can be defined as the nonlinear mapping of an input dataset to scalar output data, a consequence of Zadeh’s initial algebra.4 Such a system consists of four main parts: a fuzzifier, a set of rules, an inference engine and a defuzzifier.
The common fuzzy logic system processes data in three sequential stages: fuzzification, inference and defuzzification. In the fuzzification step, a crisp, or well-defined, set of input data is gathered and converted to a fuzzy set using fuzzy linguistic variables — that is, fuzzy linguistic terms. Second, an inference is made based on a set of rules. Last, in the defuzzification step the resulting output is mapped using so-called membership functions. A membership function is a curve that maps how each point in the input space is related to a membership grade. Using the height example, various heights in a given set would receive a membership grade between 0 and 1; the resulting curve would not define “tall” but instead would trace the transition from not tall to tall.
Practical Applications of Fuzzy Logic
Fuzzy logic was initially used in control systems such as camera lenses. Today it lies behind many mechanical systems we take for granted. For example, in a conventional air conditioner controller, the thermostat compares the temperature the user selects on the dial with the actual room temperature and turns the AC on or off. This maintains a certain temperature level. However, the actual room temperature does not always correspond to the subjective temperature felt by people in the room. Empirical analysis of how people adjust the temperature dial on air conditioners shows a number of tendencies:
- People tend to put the temperature dial lower than necessary, then forget to turn it up again, wasting energy.
- If someone changes the temperature regularly, the temperature control should be sensible — that is, the AC controller should react more quickly.
- Room temperature that varies a lot suggests the room is used a lot. Hence, control should be sensible.
There’s another variable to consider. Regularly turning the AC on or off will shorten the life of the device and cause ineffective energy usage. To prevent this from happening, air conditioner manufacturers make use of a temperature band called hysteresis — the tendency of the value of a physical property to lag the force creating it — between the on and off operations. A large hysteresis will cause the temperature at which the output changes from off to on to be lower than the set point by the amount of the hysteresis. If the hysteresis is small, the output will change near the set point, making the temperature control more responsive. Thus, the hysteresis needs to have a suitable value.
Because this kind of knowledge is difficult to model mathematically or code in a conventional algorithm, fuzzy logic has been used. The fuzzy logic system corrects the signal before the set point is reached and sets its hysteresis. To accomplish this, the system uses three input variables:
- The difference between the set temperature and the actual room temperature. When this difference is large, the system boosts the signal so that the desired temperature is reached faster (see Table 1, Rules 1 and 2) and sets the hysteresis to large so minor disturbances do not cause unnecessary on/off switches.
- The number of set temperature changes. To satisfy users who try to set the room temperature very precisely (Rule 3), the hysteresis is set to small.
- The brightness. When lights are on and the brightness is at a medium level, the temperature is set slightly higher (Rule 4) and the hysteresis is set lower. If the room is hit by direct sunlight, the set temperature is automatically reduced (Rule 5).
Table 1 shows the rule base that defines the strategy of the AC system. Each row represents a rule. The left column under “If” shows all input variables of the rules; the right column under “Then” shows all the output variables.
In this rule base, each linguistic label, such as “too cold,” “too warm,” “frequent,” “medium” or “high,” is represented by a predefined membership function.
Fuzzy Logic in Autonomous Vehicles
Air conditioners are relatively straightforward. In autonomous vehicle control systems, however, a large number of embedded systems interact with one another with the aim of controlling a car without the involvement of a human driver. Despite the complexity of this task, some car manufacturers have made considerable progress in autonomous systems, although development programs continue. Recently, Tesla introduced Autopilot, which can take full control of the vehicle’s steering wheel, throttle and brakes. Alphabet’s Google and Uber Technologies have also been testing self-driving cars. Typically, there are three important modules in a self-driving car: speed control, steering-wheel control and adaptive cruise control. We will outline the design of the speed control module with a fuzzy logic system that has three input variables — speed, range of view and road quality — and two output variables: throttle and brake.
Step 1: Fuzzification
Membership functions allow us to graphically represent a fuzzy set. These functions can assume specific shapes, such as triangular, trapezoidal, piecewise linear, Gaussian or singleton, and help represent the degree of truth in the valuation process of particular phenomena where multiple answers are possible. The type of membership function is dependent on context and is generally chosen according to the user’s experience or the nature of the data. In our example, we choose the triangle shape to express the membership functions of fuzzy sets, seen in Figures 2 through 6.
Each of these linguistic variables — speed, range of view, road quality and the level of braking and throttle — have corresponding linguistic values; for example, speed can be low, average or high, as in Figure 2. Each linguistic value is a fuzzy set with a membership function showing the membership grade of each value in the universe of discourse of the fuzzy set.
In this case, the membership functions for input and output variables are generated either from recommendations from experts such as automobile engineers or through clustering methods. More specifically, as we see in Figure 2, we have three linguistic labels of speed: low, average and high. For each crisp value of volatility along the x-axis, we may get its membership grade in corresponding fuzzy sets by taking the corresponding y-axis values. Note that an important characteristic of fuzzy logic is that a numerical value does not have to be fuzzified using only one membership function. In other words, a value can belong to multiple sets at the same time. In Figure 3, a range-of-view value of 12.5m can be considered both “low” and “average” at the same time, with different degrees of membership, at 0.25 and 0.75, respectively.
Step 2: Constructing Knowledge-Based Rules
Like the thermostat, a speed-control module for self-driving cars requires a rules base to control the output variable. A fuzzy rule is a simple “if–then” rule with a condition and a conclusion. For instance, if speed is high, range of view is low and road quality is rough, then the brake is average. Experts or training data can provide these rules or you can extract rules from the data itself, through clustering methods. The fuzzy rules in this example are listed in Table 2.
Each rule shows how the speed-control module reacts when input variables such as speed, range of view and road quality take on certain values. For instance, Rule 2 can be read as follows: If the car is moving fast, the range of view is low and the road is rough, then the system will brake with average force.
Step 3: Inference
The purpose of this step is to map a given input to an output using knowledge-based rules and fuzzy set operators.
Fuzzy set operators
After inputs are fuzzified, we can determine the degree to which each part of the antecedent is satisfied for each rule. (The antecedent is the “if” part of the rule.) If the antecedent of a given rule has more than one part, the fuzzy operator is applied to obtain a number that represents the result of the antecedent for that rule. This number is then applied through a fuzzy operator to the output function — a process known as implication. The input to the fuzzy operator is two or more membership values from fuzzified input variables. The output is a single truth value. Fuzzy set operators can also be used to combine the results of individual rules.
The rules in fuzzy logic are usually “If A and/or B, then C,” which means that we need to define operators “and” and “or.” The most commonly used fuzzy operators for “or” and “and” are max and min, respectively, which Zadeh proposed in the early years of his work on fuzzy logic.
Figure 2, Figure 3 and Figure 4 show the operator min at work, evaluating the antecedent for a brake-decision calculation involving Rule 2: If speed is high, range of view is low and road quality is rough, then brake is average. The given numeric inputs are speed = 70 miles per hour, range of view = 12.5, road quality = -0.4. The three different pieces of the antecedent yield fuzzy membership values of 0.75, 0.25 and 0.8, respectively. The fuzzy “and” operator selects the minimum of the three values, 0.25, and the fuzzy operation for this rule is complete.
Every rule has a weight (between 0 and 1), which is applied to the value of the antecedent. To make it simple, we choose the weight of 1, which has no effect at all on the implication process.
A consequent is a fuzzy set represented by a membership function, which is reshaped using a function associated with a number representing the antecedent. The input for the implication process is the antecedent value, and the output is a fuzzy set. Implication is implemented for each rule and then combined into a single fuzzy set to make a decision for the final output, a process called aggregation. The input of the aggregation process is the list of output functions generated by the implication process for each rule. The output of the aggregation process is a fuzzy set for each output variable. The whole process — from crisp inputs, implications of all rules and aggregation — is called fuzzy inference.
Step 4: Defuzzification
The input for the defuzzification process is a fuzzy set (the aggregate output fuzzy set), and the output is a single number. However, the aggregation output encompasses a range of output values, which must be defuzzified in order to produce a single output value for the set. This is the purpose of the defuzzifier component of a fuzzy logic system.
For example, assume that inference provides the result in Figure 7. The shaded area belongs to the output fuzzy result. The goal is to obtain a single crisp value. There are a number of different methods of defuzzification, such as the center of the area, center of sums, center of maximum and mean of maximum. Perhaps the most popular defuzzification method is the center of the area. The star, with the value 0.35, shows the level of braking applied to the wheels in a specific context.
Because of the rapid development of modern information technologies, it is possible today to collect, store, transfer and combine huge amounts of data at relatively low costs. However, exploiting the information contained in those data archives in an intelligent way turns out to be difficult. In knowledge discovery and data mining, there is a tendency to focus on purely data-driven approaches. However, in order to get truly useful results, we must take into account background knowledge, non-numeric information and uncertainties, and we must focus on comprehensible models. Fuzzy logic helps to make a link between traditional knowledge-driven approaches and purely data-driven ones because aspects of knowledge representation and reasoning have dominated research in fuzzy set theory for some time.
Fuzzy logic, with its ability to handle uncertainties, has been widely applied to many engineering and scientific tasks. The examples of the air-conditioner controller and the speed-control module in a self-driving car show us how fuzzy logic can be applied to systems in which information and noise go hand in hand. The inputs of the speed-control system are actually crisp numbers that are then fuzzified into fuzzy sets. Rules are derived that show hidden relationships within the input data. These rules are used in an inference module to generate the output, which is a fuzzy set. To produce the final output as a crisp number, the fuzzy set output then undergoes defuzzification to a single value.
All in all, fuzzy logic is not only a theory but another way to look at the world. Fuzzy logic presents practical ways to solve many problems in various fields. The answer does not always require complicated equations; sometimes it just needs some common sense and a little fuzzy thinking.
1. A. Zadeh. “Fuzzy Sets.” Information and Control 8, no. 3 (1965): 338-53.
2. Eyke Hüllermeier. “Does Machine Learning Need Fuzzy Logic?” Fuzzy Sets and Systems 281 (2015): 292-99.
3. “Fuzzy Control Programming, Technical Report.” International Electrotechnical Commission (1997).
4. Jerry M. Mendel, “Fuzzy Logic Systems for Engineering: A Tutorial,” Proceedings of the IEEE 83, no. 3 (1995):345-77.
Thought Leadership articles are prepared by and are the property of WorldQuant, LLC, and are being made available for informational and educational purposes only. This article is not intended to relate to any specific investment strategy or product, nor does this article constitute investment advice or convey an offer to sell, or the solicitation of an offer to buy, any securities or other financial products. In addition, the information contained in any article is not intended to provide, and should not be relied upon for, investment, accounting, legal or tax advice. WorldQuant makes no warranties or representations, express or implied, regarding the accuracy or adequacy of any information, and you accept all risks in relying on such information. The views expressed herein are solely those of WorldQuant as of the date of this article and are subject to change without notice. No assurances can be given that any aims, assumptions, expectations and/or goals described in this article will be realized or that the activities described in the article did or will continue at all or in the same manner as they were conducted during the period covered by this article. WorldQuant does not undertake to advise you of any changes in the views expressed herein. WorldQuant and its affiliates are involved in a wide range of securities trading and investment activities, and may have a significant financial interest in one or more securities or financial products discussed in the articles.