0
我目前正在为我的课程实施程序分类器。 我的讲师要求我使用“演化ANN”算法。因此,我找到了一个名为NEAT(增强拓扑的神经演变)的软件包。 我有10个输入和7个输出,然后我只是从它的文档修改源。具有多输出的NEAT
def eval_fitness(genomes):
for g in genomes:
net = nn.create_feed_forward_phenotype(g)
mse = 0
for inputs, expected in zip(alldata, label):
output = net.serial_activate(inputs)
output = np.clip(output, -1, 1)
mse += (output - expected) ** 2
g.fitness = 1 - (mse/44000) #44000 is the number of samples
print(g.fitness)
我也改变了配置文件,所以程序有10个输入和7个输出。 但是当我尝试运行代码,它给了我错误
Traceback (most recent call last):
File "/home/ilhammaziz/PycharmProjects/tuproSC2/eANN.py", line 40, in <module>
pop.run(eval_fitness, 10)
File "/home/ilhammaziz/.local/lib/python3.5/site-packages/neat/population.py", line 190, in run
best = max(population)
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
我应该怎么办? 谢谢
有没有什么特别的理由可以选择NEAT,你的教授用'进化ANN'算法是什么意思,一个简单的多层感知器属于这个类别? – Ironluca
其实我没有选择NEAT的理由,'进化ANN'我认为它和神经进化一样。整洁的参考http://neat-python.readthedocs.io/en/latest/index.html –