arruda / scikit_fuzzy_fcl

A plugin for scikit-fuzzy that provides a parser for Fuzzy Control Language (as described in IEC 61131-7)
MIT License
2 stars 1 forks source link

How to interpret MF (Term) values when no MF type is defined #1

Closed arruda closed 7 years ago

arruda commented 7 years ago

Description

I'm a bit stuck in this point :disappointed: . The problem is how to interpret this:

FUZZIFY antecedent1
       TERM mf1 := (0, 1) (1, 1);  // this could be any number of '(float, float)'.
END_FUZZIFY

What I Did

For now this is what I have (considering the example above):

antecedent = Antecedent(universe=None, 'antecedent1')  # universe will be set latter, don't matter now
antecedent['mf1'] = magic_function([ [0, 1], [1, 1] ])

So basically what I'm missing is the magic_function that will transform the [ [0, 1], [1, 1] ] into the expected used in scikit-fuzzy's Term.mf (I believe its a 1d array, because all scikit-fuzzy mfs return this: http://pythonhosted.org/scikit-fuzzy/api/skfuzzy.membership.html)

arruda commented 7 years ago

ops, just figured it out:

TERM mf1 := (0, 1) (1, 1)

(0 , 1) basically this is it:1 = mf(0) and 1 = mf(1) in this case.

JDWarner commented 7 years ago

Yup you got it! Sorry for the delay.

Scikit-fuzzy now really likes sparse membership functions, piecewise ones where the only data are where the MF has a discontinuous first derivative. The rest are interpolated in a linear fashion as needed.