skfuzzy.control
. However, many of the necessary pieces for working with Type-2 systems are exposed in the base namespace as general purpose functions in the toolkit. I suspect much of the low-level legwork is present, but this isn't part of my active work so I am not entirely certain what might need to be tweaked or generalized.
@misc{https://doi.org/10.5281/zenodo.3541384,
doi = {10.5281/ZENODO.3541384},
url = {https://zenodo.org/record/3541384},
author = {Warner, Josh and Sexauer, Jason and {Scikit-Fuzzy} and {Twmeggs} and {Alexsavio} and {Aishwarya Unnikrishnan} and Castelão, Guilherme and Pontes, Felipe Arruda and Uelwer, Tobias and {Pd2f} and {Laurazh} and Batista, Fernando and {Alexbuy} and Broeck, Wouter Van Den and Song, William and Badger, The Gitter and Pérez, Roberto Abdelkader Martínez and Power, James F. and {Himanshu Mishra} and Trullols, Guillem Orellana and Hörteborn, Axel and {99991}},
title = {scikit-fuzzy/scikit-fuzzy: Scikit-Fuzzy 0.4.2},
publisher = {Zenodo},
year = {2019},
copyright = {Open Access}
}
@JDWarner
Dear,
I am sorry to @you here. but i am have a question. I am first to use the ctrl system.
tip['medium'] = fuzz.trimf(tip.universe, [0, 13, 25]) -> the fuzz.trimf should return an array of membership;
but when i use the tip['medium'], it is a consequent. so how to get the membership value just from tip['medium']. if i print(tip['medium']), it did not return anything.
Hey everyone!
Firstly, let me congratulate and thank the authors of this package as it looks like to be a great tool.
Secondly, I'm here because I've encountered some problems while running it and would like to ask for your help with some questions regarding the cmeans and cmeans_predict functions:
when inserting the data in the cmeans and cmeans_predict functions, does the last column have to be the target column?
My objective is to classify in 0 and 1s, data with 27 columns (26 features + 1 targets) so I need 2 clusters with, if I'm not mistaken, centers with 27 coordinates. When I create the model with the training data, the function returns the variable cntr with a shape of (2,6224). Can you explain why does the function return these values?
After obtaining this cntr variable and applying it to the cmeans_predict function, with test_data with the same number of columns, I get the following error:
"XA and XB must have the same number of columns (i.e. feature dimension.)"
Could you explain why does this happen?
Thank you, again, for your work.
Best Regards,
Hello everyone!
I have a problem with Trapezoidal membership function generator:
I have 3 input & 1 output:
x_Recency = ctrl.Antecedent(np.arange(0, 2, 1),'x_Recency')
x_Frequency =ctrl.Antecedent(np.arange(0, 2, 1),'x_Frequency')
x_Monetary =ctrl.Antecedent(np.arange(0, 7000, 1),'x_Monetary')
x_Score = ctrl.Consequent(np.arange(0,101, 1),'x_Score')
x_Recency['old']= fuzz.trapmf(x_Recency.universe, [0 ,0, 0.5, 1])
x_Recency['new']= fuzz.trapmf(x_Recency.universe, [0,0.5, 1,1])
x_Frequency['rarely'] = fuzz.trapmf(x_Frequency.universe, [-1,-1,0, 0.55])
x_Frequency['often'] = fuzz.trapmf(x_Frequency.universe, [0,0.55, 1, 1])
x_Monetary['low'] = fuzz.trapmf(x_Monetary.universe, [0,0, 873.5,7000])
x_Monetary['high'] = fuzz.trapmf(x_Monetary.universe, [873.5, 6000, 7000,7000])
x_Recency.view()
x_Frequency.view()
x_Monetary.view()
the x_Recency,x_Frequency inputs doesn't appeare with form Trapezoidal like x_Monetary.
I think the reason is the small range [0,1]... any ideas to change the parameter abcd for fuzz.trapmf..
regards
from skfuzzy import control as ctrl
from pympler import muppy,tracker
import skfuzzy as fuzz
import numpy as np
import sys
def base_example():
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['low'] = fuzz.trimf(tip.universe, [0, 0, 13])
tip['medium'] = fuzz.trimf(tip.universe, [0, 13, 25])
tip['high'] = fuzz.trimf(tip.universe, [13, 25, 25])
rule1 = ctrl.Rule(quality['poor'] | service['poor'], tip['low'])
rule2 = ctrl.Rule(service['average'], tip['medium'])
rule3 = ctrl.Rule(service['good'] | quality['good'], tip['high'])
tipping_ctrl = ctrl.ControlSystem([rule1, rule2, rule3])
tipping = ctrl.ControlSystemSimulation(tipping_ctrl)
tipping.input['quality'] = 6.5
tipping.input['service'] = 9.8
tipping.compute()
if __name__ == '__main__':
tr = tracker.SummaryTracker() # to show the initial list of objects
for i in range(100000):
base_example()
if i%500==0: # we monitor different in the list of objects every 500 iterations
print('Iteration ',i)
tr.print_diff() # to show the difference beween this iteration and the base one