home › Forums › # Technical Support › Output data in natural language
- This topic has 4 replies, 2 voices, and was last updated 6 years, 11 months ago by
Unknown.
-
AuthorPosts
-
October 30, 2016 at 07:24 #2268
Unknown
MemberHi!
First thank you for the library. It’s helping me to learn fuzzy logic really quickly.
Maybe the question i have it’s more a problem of understanding and there’s no need to do it but,
is there a way after defuzzify to convert outputVariable value to natural language.October 30, 2016 at 12:05 #2269Juan Rada-Vilela (admin)
KeymasterHi,
thanks for your post.
I assume that by “natural language” you refer to the fuzzy output value.
Taking
OutputVariable outputVariable = engine.getOutputVariable("SomeName");
, there are two ways to get the fuzzy output value:(1)
outputVariable.fuzzyOutputValue()
will get you a string like"0.8/LOW + 0.1/MED + 0.0/HI"
, which refers to the fuzzy output value of the variable. This fuzzy value is the value that you defuzzify withoutputVariable.defuzzify()
.
(2)outputVariable.fuzzify(outputVariable.getOutputValue())
will give you a similar string, but will compute the membership function for each term at the given output value. The results are not necessarily the same.I think you are mostly interested in (1).
October 30, 2016 at 12:49 #2270Unknown
MemberOK Thank you. Your answer helped me to understand fuzzy logic and how your library works.
Any how I think I didn’t ask my question right, or maybe I don’t understand how fuzzy logic process work.
How ever i’ll try again, taking your example code on github repository:for (int i = 0; i < 50; ++i) {
double light = ambient.getMinimum() + i * (ambient.range() / 50);
ambient.setInputValue(light);
engine.process();
FuzzyLite.logger().info(String.format(
"Ambient.input = %s -> Power.output = %s",
Op.str(light), Op.str(power.getOutputValue())));
}
Is it possible to create a statement such as:
if power.getOutputValue() belongs to HIGH then do something"
Thank you, and sorry.October 30, 2016 at 13:05 #2271Juan Rada-Vilela (admin)
KeymasterHi,
The value of
if (power.getOutputValue() belongs to HIGH)
is not true or false, it is a value between 0.0 and 1.0, where 0.0 is false, 1.0 is true, and the values in between indicate to what degree the output value belongs to the term HIGH. As such, you may want to use some value as threshold:... engine.defuzzify(); if (outputVariable.fuzzyOutput().activationDegree(outputVariable.getTerm("HIGH")) > threshold){ //do something }
does this answer your question?
October 30, 2016 at 13:30 #2272Unknown
MemberYes! Thank you. Really fast answers by the way.
-
AuthorPosts
- You must be logged in to reply to this topic.