Composing Fuzzy If–Then Rules
To build decision-making systems with fuzzy logic, you use fuzzy if–then rules. These rules allow you to express knowledge in a form like:
IF condition(s) THEN result.
In fuzzy logic, each condition is called an antecedent, and the result is the consequent. Antecedents are often based on fuzzy sets, and can involve multiple conditions combined with fuzzy operators such as AND, OR, or NOT.
For example, a rule might look like:
IF temperature is "high" AND humidity is "low" THEN fan speed is "fast".
Each antecedent evaluates to a degree of membership (between 0 and 1), based on how well the input matches the fuzzy set. When combining multiple antecedents, you use fuzzy operators:
- AND: typically uses the minimum of the membership degrees;
- OR: typically uses the maximum;
- NOT: typically uses one minus the membership degree.
This way, the rule's activation can reflect partial truths, not just binary true/false values.
12345678910111213import numpy as np # Define membership degrees for two fuzzy sets: A and B # Suppose for a given input, A = 0.7 (e.g., temperature is "high" to degree 0.7) # and B = 0.4 (e.g., humidity is "low" to degree 0.4) A = 0.7 B = 0.4 # Fuzzy rule: IF A AND B THEN C # Use the minimum t-norm for AND rule_activation = np.minimum(A, B) print("Activation degree of the rule (IF A AND B THEN C):", rule_activation)
The computed activation, in this case 0.4, indicates the degree to which the rule applies for the given inputs. This value tells you how strongly the combined antecedent conditions are satisfied. In fuzzy systems, this activation degree is then used to determine the influence of the rule's consequent (e.g., how much "fan speed is fast" should be applied). Lower activation means the rule is less applicable, while higher activation means it is more relevant for the current situation.
Tack för dina kommentarer!
Fråga AI
Fråga AI
Fråga vad du vill eller prova någon av de föreslagna frågorna för att starta vårt samtal
Fantastiskt!
Completion betyg förbättrat till 6.67
Composing Fuzzy If–Then Rules
Svep för att visa menyn
To build decision-making systems with fuzzy logic, you use fuzzy if–then rules. These rules allow you to express knowledge in a form like:
IF condition(s) THEN result.
In fuzzy logic, each condition is called an antecedent, and the result is the consequent. Antecedents are often based on fuzzy sets, and can involve multiple conditions combined with fuzzy operators such as AND, OR, or NOT.
For example, a rule might look like:
IF temperature is "high" AND humidity is "low" THEN fan speed is "fast".
Each antecedent evaluates to a degree of membership (between 0 and 1), based on how well the input matches the fuzzy set. When combining multiple antecedents, you use fuzzy operators:
- AND: typically uses the minimum of the membership degrees;
- OR: typically uses the maximum;
- NOT: typically uses one minus the membership degree.
This way, the rule's activation can reflect partial truths, not just binary true/false values.
12345678910111213import numpy as np # Define membership degrees for two fuzzy sets: A and B # Suppose for a given input, A = 0.7 (e.g., temperature is "high" to degree 0.7) # and B = 0.4 (e.g., humidity is "low" to degree 0.4) A = 0.7 B = 0.4 # Fuzzy rule: IF A AND B THEN C # Use the minimum t-norm for AND rule_activation = np.minimum(A, B) print("Activation degree of the rule (IF A AND B THEN C):", rule_activation)
The computed activation, in this case 0.4, indicates the degree to which the rule applies for the given inputs. This value tells you how strongly the combined antecedent conditions are satisfied. In fuzzy systems, this activation degree is then used to determine the influence of the rule's consequent (e.g., how much "fan speed is fast" should be applied). Lower activation means the rule is less applicable, while higher activation means it is more relevant for the current situation.
Tack för dina kommentarer!