Reputation: 483
I want to make an inference fuzzy engine which infers 3 types of rules:
Each rule has a hypothesis set, a conclusion set, and a certainty factor. In the set's facts, if a fact is a fuzzy fact then it has a degree of truth.
There are tutorials to infer crisp rules and fuzzy rules, but how can I infer hybrid rules?
Upvotes: 0
Views: 88
Reputation: 962
Aren't fuzzy rules generalization of crisp rules (if I understand what you mean by crisp rules correctly). The way to convert a fuzzy rule into a crisp rules is to make sure that membership function (MF) in antecedent is not overlapping with any other membership function and MF in consequent is such that, when defuzzified it essentially gives single crisp value.
For example: Input Temperature as following MFs :
temp_low_mf = fuzz.trimf(x_temp, [0, 0, 10])
temp_med_mf = fuzz.trimf(x_temp, [0, 20, 45])
temp_high_mf = fuzz.trimf(x_temp, [20, 45, 45])
Output fan speed has one of the MFs related to crisp rule:
fanspeed_low_mf = fuzz.trimf(x_fanspeed, [0, 0, 0])
So fuzzy rule below is effectively a crisp rule:
rule1 = ctrl.Rule(tempAnt['low'], fanspeedCon['low'], "Cold Climate Rule")
Viz: If temp is less than 10, then fan speed should be 0.
Upvotes: 1