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 –