当前位置: 首页>>代码示例>>Python>>正文


Python Classifier.action方法代码示例

本文整理汇总了Python中Classifier.Classifier.action方法的典型用法代码示例。如果您正苦于以下问题:Python Classifier.action方法的具体用法?Python Classifier.action怎么用?Python Classifier.action使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Classifier.Classifier的用法示例。


在下文中一共展示了Classifier.action方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: gen_match_set

# 需要导入模块: from Classifier import Classifier [as 别名]
# 或者: from Classifier.Classifier import action [as 别名]
def gen_match_set(pop: list, percept: list):
    """
    Generate a list of Classifier thats match current perception
    :param pop:
    :type pop: list
    :param percept:
    :type percept: list
    :return:
    :rtype: list
    """
    ma = []
    if time == 0 or len(pop) == 0:
        for i in range(cons.nbAction):
            newcl = Classifier()
            newcl.condition = [cons.symbol] * cons.lenCondition
            newcl.action = i
            newcl.effect = [cons.symbol] * cons.lenCondition
            newcl.exp = 0
            newcl.t = time
            newcl.q = 0.5
            pop.append(newcl)
    for c in pop:
        if does_match(c, percept):
            ma.append(c)
    return ma
开发者ID:masterchef8,项目名称:ACS2,代码行数:27,代码来源:ACS2.py

示例2: cover_triple

# 需要导入模块: from Classifier import Classifier [as 别名]
# 或者: from Classifier.Classifier import action [as 别名]
def cover_triple(percept_: list, action: int, percept: list, t: int) -> Classifier:
    child = Classifier()

    for i in range(len(percept)):
        if percept_[i] != percept[i]:
            child.condition[i] = percept_[i]
            child.effect[i] = percept[i]
    child.action = action
    child.exp = 0
    child.r = 0
    child.aav = 0
    child.alp = t
    child.tga = t
    child.t = t
    child.q = 0.5
    child.num = 1
    return child
开发者ID:masterchef8,项目名称:ACS2,代码行数:19,代码来源:ACS2.py

示例3: apply_mutation

# 需要导入模块: from Classifier import Classifier [as 别名]
# 或者: from Classifier.Classifier import action [as 别名]
def apply_mutation(cl: Classifier, perception: list):
    """
    :type cl: Classifier
    :param cl:
    :type perception: list
    :param perception:
    :return:
    """
    for i in range(len(cl.condition)):
        if rd.random() < cons.nu:
            if cl.condition[i] == cons.dontCare:
                cl.condition[i] = perception[i]
            else:
                cl.condition[i] = cons.dontCare
    if rd.random() < cons.nu:
        c = rd.choice([i for i in range(0, (cons.nbAction - 1))])
        cl.action = c
开发者ID:masterchef8,项目名称:XCS,代码行数:19,代码来源:XCS.py

示例4: generate_covering_classifier

# 需要导入模块: from Classifier import Classifier [as 别名]
# 或者: from Classifier.Classifier import action [as 别名]
def generate_covering_classifier(env, action):
    newcl = Classifier()
    newcl.condition = ['0'] * len(env)

    for i in range(len(env)):
        if rd.random() < cons.P_dontcare:
            newcl.condition[i] = cons.dontCare
        else:
            newcl.condition[i] = env[i]
    for i in range(len(action)):
        if action[i] is False:
            newcl.action = i
    newcl.prediction = cons.predictionIni
    newcl.predictionError = cons.predictionErrorIni
    newcl.fitness = cons.fitnessIni
    newcl.experience = 0
    newcl.timeStamp = time
    newcl.actionSetSize = 1
    newcl.numerosity = 1
    return newcl
开发者ID:masterchef8,项目名称:XCS,代码行数:22,代码来源:XCS.py


注:本文中的Classifier.Classifier.action方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。