home Forums # Technical Support Output data in natural language

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #2268
    Unknown
    Member

    Hi!
    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.

    #2269

    Hi,

    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 with outputVariable.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).

    #2270
    Unknown
    Member

    OK 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.

    #2271

    Hi,

    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?

    #2272
    Unknown
    Member

    Yes! Thank you. Really fast answers by the way.

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.