微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

当人口规模为 1 时除以零整洁-python

如何解决当人口规模为 1 时除以零整洁-python

注意:我提交了an issue on their GitHub,但是查看了他们的 GitHub,但看起来没有人会根据提交的其他问题进行回复

File "C:\Users\hunty\AppData\Local\RLBotGUIX\venv\lib\site-packages\neat\math_util.py",line 9,in mean
    return sum(map(float,values)) / len(values)
ZeroDivisionError: division by zero

当我的模型的人口规模设置为 1 时,我收到除以 0 的错误,当设置为数字 > 1 时,我没有收到错误。我找到了一个与此相关的堆栈溢出页面,但没有解决方案。

这是我的一些代码配置文件(重要的部分):

[NEAT]
fitness_criterion     = max
fitness_threshold     = 9999
pop_size              = 2
reset_on_extinction   = False

评估/健身功能

def main(gnomes,config):
    global net,ge
    net = neat.nn.FeedForwardNetwork(gnomes[0],config)
    ge = gnomes[0]
    ge.fitness = 0

如果您有解决方案或需要更多代码,请说出来!

整个追溯:

 ****** Running generation 0 ******

Process Process-1:
Traceback (most recent call last):
  File "C:\Users\hunty\AppData\Local\RLBotGUIX\python37\lib\multiprocessing\process.py",line 297,in _bootstrap
    self.run()
  File "C:\Users\hunty\AppData\Local\RLBotGUIX\python37\lib\multiprocessing\process.py",line 99,in run
    self._target(*self._args,**self._kwargs)
  File "C:\Users\hunty\AppData\Local\RLBotGUIX\venv\lib\site-packages\rlbot\setup_manager.py",line 655,in run_agent
    bm.run()
  File "C:\Users\hunty\AppData\Local\RLBotGUIX\venv\lib\site-packages\rlbot\botmanager\bot_manager.py",line 196,in run
    self.load_agent()
  File "C:\Users\hunty\AppData\Local\RLBotGUIX\venv\lib\site-packages\rlbot\botmanager\bot_manager.py",line 117,in load_agent
    self.agent = agent_class(self.name,self.team,self.index)
  File "C:\Users\hunty\AppData\Local\RLBotGUIX\MyBots\learnie\src\bot.py",line 40,in __init__
    run(config_path)
  File "C:\Users\hunty\AppData\Local\RLBotGUIX\MyBots\learnie\src\bot.py",line 30,in run
    winner = p.run(main)
  File "C:\Users\hunty\AppData\Local\RLBotGUIX\venv\lib\site-packages\neat\population.py",line 89,in run
    fitness_function(list(iteritems(self.population)),self.config)
  File "C:\Users\hunty\AppData\Local\RLBotGUIX\MyBots\learnie\src\bot.py",line 18,in main
    net = neat.nn.FeedForwardNetwork(gnomes[0],config)
TypeError: __init__() missing 1 required positional argument: 'node_evals'
uninitialized_bot error reading header: An existing connection was forcibly closed by the remote host

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。