home Forums # Technical Support Map getOutputValue() to the concerned membership function Reply To: Map getOutputValue() to the concerned membership function

#1827

Hi Abhishek,

thank you for your kind words and contribution.

First, the output of your controller is a fuzzy value. For example, \tilde{y} = 0.3/indoor+0.4/outdoor+0.2/semioutdoor. This fuzzy output is then defuzzified, which results in the scalar value y=0.33 that you mention.

You are asking to find out whether your fuzzy output is indoor, outdoor, semioutdoor. And the answer is: it is likely to be a fuzzy value including all options. Having this in mind, I think what you may be after is what is the "truncated" output? removing all fuzziness.

You have two options.

(1) Fuzzification after Defuzzification: You take the output value y=2.5, and you find the Term in the OutputVariable with highest membership function for y, that is, the term with the highest \mu(y). You can do this by utilising Term* term = outputVariable->highestMembershipFunction(y);. Optionally, you can pass scalar highest to store the highest \mu(y): Term* term = outputVariable->highestMembershipFunction(y, &highest);. This will iterate over the terms in the OutputVariable and return the one with the highest \mu.

(2) FuzzyOutput. You find the term with the highest accumulated activation degree in your outputVariable->fuzzyOutput().

 scalar highestActivation = -fl::inf; scalar highestTerm = fl::null;
for const Term* term in OutputVariable:
scalar accumulatedActivation = outputVariable->fuzzyOutput()->activationDegree(term);
if (accumulatedActivation > highestActivation){
highestActivation = accumulatedActivation;
highestTerm = term;
}


I prefer (2) over (1) because in (1) you lose information after defuzzification.

Methods (1) and (2) can be clearly seen in QtFuzzyLite 5. In main window, on your OutputVariable, click on ỹ in ỹ=0.000/LOW + 0.320/MEDIUM + 0.680/HIGH. This will swap to μ(y)=0.000/LOW + 0.352/MEDIUM + 0.648/HIGH. As you can see, ỹ is (2), and μ(y) is (1).