使用skfuzzy定义高斯贝尔mf后如何获取mf值?

时间:2018-09-25 15:04:09

标签: python fuzzy-logic skfuzzy

抱歉,这里有super noob问题,但是我正在尝试使用skfuzzy框架创建一些高斯钟形隶属函数,如下所示

    import numpy as np
import skfuzzy as fuzz
from skfuzzy import control as ctrl

# New Antecedent/Consequent objects hold universe variables and membership
# functions
quality = ctrl.Antecedent(np.arange(0, 11, 1), 'quality')
service = ctrl.Antecedent(np.arange(0, 11, 1), 'service')
tip = ctrl.Consequent(np.arange(-30, 30, 1), 'tip')

# Auto-membership function population is possible with .automf(3, 5, or 7)
quality.automf(3)
service.automf(3)

# Custom membership functions can be built interactively with a familiar,
# Pythonic API
#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])
arr = []
sigma = 2.5
tip["EL"] = fuzz.gaussmf(tip.universe, -30, sigma)
tip["VL"] = fuzz.gaussmf(tip.universe, -20, sigma)
tip["L"] = fuzz.gaussmf(tip.universe, -10, sigma)
tip["M"] = fuzz.gaussmf(tip.universe, 0, sigma)
tip["H"] = fuzz.gaussmf(tip.universe, 10, sigma)
tip["VH"] = fuzz.gaussmf(tip.universe, 20, sigma)
tip["EH"] = fuzz.gaussmf(tip.universe, 30, sigma)

tip.view()

,创建完此代码后,我希望能够根据如下创建的每个模糊段(tip [“ EH”]。input = 5并基于创建的钟形曲线)取回值。我想根据图返回隶属函数值。 我已经浏览了该文档,但无法获取它。 请帮忙! 谢谢

0 个答案:

没有答案