pyknow icon indicating copy to clipboard operation
pyknow copied to clipboard

Enhancement: FuzzyPyKnow

Open Bazmundi opened this issue 8 years ago • 2 comments

Inline with fuzzyClips, fuzzy extensions to facts please.

Bazmundi avatar Jan 26 '18 22:01 Bazmundi

This is a desirable feature for a future release and is definitely in the long-term roadmap.

Because we are no experts in fuzzyClips we are open to know if you have any ideas on how to implement this. If you want to contribute with a pull request, please feel free to do so.

nilp0inter avatar Feb 05 '18 10:02 nilp0inter

You can technically do it now, it's just a bit of a pain. Oh, and OR rules will ditch after the first success, even if there are other matches with relevant variables. See:

 @Rule(FuzzyFact(name="C", probability=MATCH.c), FuzzyFact(name="E", probability=MATCH.e))
    def fuzzy_rule_c_and_e_equals_f(self, c, e):
        self.declare(FuzzyFact(name="F", probability= c * e));
        
    def fuzzy_or(self, a, b):
        return a + b - a * b;
    
    @Rule(OR(FuzzyFact(name="E", probability=MATCH.e), FuzzyFact(name="F", probability=MATCH.f), FuzzyFact(name="G", probability=MATCH.g)))
    def fuzzy_rule_e_f_or_g_equals_f(self, e = 0, f = 0, g = 0):
        
        self.declare(FuzzyFact(name="H", probability= self.fuzzy_or(self.fuzzy_or(e, f), g)));
      

Angular-Angel avatar May 23 '19 13:05 Angular-Angel