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


Python Population.evolve方法代码示例

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


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

示例1: range

# 需要导入模块: from Population import Population [as 别名]
# 或者: from Population.Population import evolve [as 别名]
REPETION_NUMBER = 1
POPULATION_SIZE_DEFAULT = 100
WAIT_FOR_GENERATIONS = True
TYPE = None
SURVIVOR_MODE = Population.SURVIVOR_GENERATION
GENERATION_LIMIT = 10000
tournament_settings = {'size': 20, 'reallocation':True}

if __name__ == '__main__':

    generation_per_repetion = []
    elite_counter_per_repetion = []

    for i in range(REPETION_NUMBER):
        pop = Population(POPULATION_SIZE_DEFAULT, 8, WAIT_FOR_GENERATIONS, TYPE, SURVIVOR_MODE, tournament = tournament_settings, generation_limit = GENERATION_LIMIT)
        ans = pop.evolve()

        bestInd = ans[0]
        number_generation = ans[1]
        means = ans[2]
        elite_counter = ans[3]
        selection_pressure = ans[4]

        if SURVIVOR_MODE == Population.SURVIVOR_GENERATION:
            elite_counter_per_repetion.append(str(2*elite_counter/(number_generation*POPULATION_SIZE_DEFAULT)))
            generation_per_repetion.append(str(number_generation*POPULATION_SIZE_DEFAULT))
        else:
            elite_counter_per_repetion.append(str(elite_counter/number_generation))
            generation_per_repetion.append(str(number_generation))
        #print(bestInd, bestInd.count_collisions, bestInd.fitness, number_generation)
开发者ID:victorddiniz,项目名称:IF706_BIO,代码行数:32,代码来源:main.py

示例2: Dataset

# 需要导入模块: from Population import Population [as 别名]
# 或者: from Population.Population import evolve [as 别名]
from Population import Population
from Dataset import Dataset

if __name__ == '__main__':
    dataset = Dataset()
    pop = Population(dataset, 10, 2, dimension_limit=2)
    print('Init evolve')
    (best, max_fit, mean_fit, elitism_degree, selection_pressure) = pop.evolve()
    print(best, best.fitness)
    File.save('max_fitness.data', [str(v) for v in max_fit])
    File.save('mean_fitness.data', [str(v) for v in mean_fit])
    File.save('elitism_degree.data', str(elitism_degree))
    File.save('selection_pressure.data', [str(v)for v in selection_pressure])
    Fiel.save('AUC.data', str(best.auc))
开发者ID:victorddiniz,项目名称:DecodingBrainSignalsProject,代码行数:16,代码来源:main.py


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