How to use multiple fuzzy input sets / relationships in scikit-fuzzy?

2.8k views Asked by At

I'm making a fuzzy agent with scikit-fuzzy which determines how good a basketball player is based on length and motivation. Obviously this is a learning project and not a realistic implementation.

In a simple example with only a relationship between length and quality, I have the following fuzzy rules:

R1 = fuzz.relation_product(l_tall, q_good)
R2 = fuzz.relation_product(l_moderate, q_moderate)
R3 = fuzz.relation_product(l_short, q_bad)
R_combined = np.fmax(R1, np.fmax(R2, R3))
fuzz.defuzz(quality, R_combined[length == 180], 'centroid')

This returns a crisp value, as expected.

However, when I work with two kinds of relationships:

#Relationships between motivation and quality of player
R1 = fuzz.relation_product(m_very, q_good)
R2 = fuzz.relation_product(m_barely, q_bad)

#Relationships between length and quality of player

R3 = fuzz.relation_product(l_tall, q_good)
R4 = fuzz.relation_product(l_short, q_bad)

I don't know what to do next to make it work. Do I combine all the rules, or only the similar rules, and how do I use the defuzzify function afterwards? I need to be able to have two parameters (length and motivation), so the approach I used above cannot work.

1

There are 1 answers

1
Carlos Garcia Serna On

There isn't much documentation for scikit fuzzy, however I found an implementation of the classical tipping example that you might find useful

http://nbviewer.ipython.org/gist/kickapoo/2cec262723390d6f386a