Following the tip example from scikit-fuzzy, I have used the following code to create an input/output to a fuzzy control system:
quality = ctrl.Antecedent(np.arange(0, 11, 1), 'quality')
service = ctrl.Antecedent(np.arange(0, 11, 1), 'service')
tip = ctrl.Consequent(np.arange(0, 26, 1), 'tip')
quality.automf(3)
service.automf(3)
tip.automf(3)
In the "Fuzzy rules" section of the example, the rules are manually written. I would like to generate them from training examples.
Suppose I have a set of (quality, service, tip) tuples, where quality and service range from 0 to 10 and tip ranges from 0 to 25. I would like to be able to generate automatically a rule from each training tuple. In order to do so, I need to map the values of quality and service (respectively tip) to a term (a.k.a linguistic value): either 'poor', 'average', or 'good' (respectively 'low', 'medium', or 'high').
How can I do that with scikit-fuzzy
?