当我尝试执行以下代码时,它显示异常。我导入了小巧和模糊。
发生异常:NameError名称'FuzzyReasoner'不是 定义文件“ F:\ code \ f.py”,第6行,在 FR = FuzzyReasoner()文件“ C:\ ProgramData \ Anaconda3 \ Lib \ runpy.py”,第85行,_run_code exec(代码,run_globals)文件“ C:\ ProgramData \ Anaconda3 \ Lib \ runpy.py”,第96行,在_run_module_code中 mod_name,mod_spec,pkg_name,script_name)文件“ C:\ ProgramData \ Anaconda3 \ Lib \ runpy.py”,行263,在run_path中 pkg_name = pkg_name,script_name = fname)
from miniful import *
from skfuzzy import *
FR =FuzzyReasoner()
RULE1 = "IF (OXI IS low_flow) THEN (POWER IS LOW_POWER)"
RULE2 = "IF (OXI IS medium_flow) THEN (POWER IS MEDIUM_POWER)"
RULE3 = "IF (OXI IS high_flow) THEN (POWER IS HIGH_POWER)"
FR.set_crisp_output_value("LOW_POWER", 0)
FR.set_crisp_output_value("MEDIUM_POWER", 25)
FR.set_crisp_output_value("HIGH_POWER", 100)
FS_1 = FuzzySet( points=[[0, 1.], [1., 1.], [1.5, 0]],term="low_flow" )
FS_2 = FuzzySet( points=[[0.5, 0], [1.5, 1.], [2.5, 1], [3., 0]], term="medium_flow" )
FS_3 = FuzzySet( points=[[2., 0], [2.5, 1.], [3., 1.]],term="high_flow" )
FR.add_membership_function("OXI", MembershipFunction( [FS_1, FS_2, FS_3], concept="OXI" ))
FR.add_rules([RULE1, RULE2, RULE3])
FR.set_variable("OXI", .4)
print (FR.Sugeno_inference(['POWER']))
帮助我解决此错误,并建议我哪些模块可用于python中的Fuzzylogic。 “会员”功能也显示相同的错误。 我从https://github.com/aresio/miniful
获得了这段代码