interp_membership against ctrl.antecedent?

167 views
Skip to first unread message

Jotham Lentz

unread,
Dec 18, 2017, 12:42:58 AM12/18/17
to scikit-fuzzy
Howdy, 

I'm playing with the control.antecedent and I like the way it greatly simplifies universe creation.   But for what I"m doing I have a need to evaluate values against the antecedent, as you would the "hard way" with fuzz.interp_membership() is there any way to use automf to generate the functions, and return membership in each function for given values?

Thanks,

Joe

Joshua Warner

unread,
Dec 24, 2017, 6:11:12 PM12/24/17
to Jotham Lentz, scikit-fuzzy

Hi Joe,

Sorry for the delay. I think this is possible, assuming I understand you correctly, though it might be a little less intuitive than ideal. The system is pretty tightly integrated. But, let’s say you have a control system named tip and a control system simulation object named tip_sim without input values. Then you can do:

# Set inputs
tip_sim.input['quality'] = 8
tip_sim.input['service'] = 7

# Run the system
tip_sim.compute()

# Extract the antecedent you want (just one of multiple ways)
ants = [i for i in tip_sim.ctrl.antecedents]

ant = ants[0]  # Select the antecedent you want

# Some variation on this to yield the membership values
print(['For term \'{0}\' membership is {1}'.format(label, term.membership_value[tip_sim]) 
       for (label, term) in ant.terms.iteritems()])

Hope that helps and happy holidays!

Josh

Jotham Lentz

unread,
Dec 24, 2017, 8:20:18 PM12/24/17
to Joshua Warner, scikit-fuzzy
That's perfect.  I'll give it a shot.  Thanks.
Reply all
Reply to author
Forward
0 new messages