复杂神经网络中的前向传播

数据挖掘 神经网络
2022-03-03 08:17:34

在典型的神经网络中,每一层都有一定数量的神经元,所有神经元都有来自前一层每个神经元的传入连接(反之亦然)。这我没有问题弄清楚如何传播。

但是,当您的网络没有层中的神经元时(我正在研究 NEAT 算法);例如,神经元只是基于遗传算法连接(随机创建 - 然后测试适应度),没有一种简单的方法来确定如何前向传播;

1 input neuron - connected to neurons 2 and 3
Neuron 2 is also connected to neuron 3
Neuron 3 is connected to the output.

现在在这种情况下,如果我只是在数字上进行,那么一切都会很好。然而,随着这种微妙的变化;

1 input neuron - connected to neurons 2 and 3
Neuron **3** is also connected to neuron **2**
Neuron **2** is connected to the output.

通过; 1, 2, 然后 3 意味着神经元 2 不包括来自神经元 3 的输入。我可以看到有一种蛮力的方法,但有没有更好、更有效的方法?

1个回答

你可以做拓扑排序例如,这里有一些 pythonic 伪代码

def order(current_neuron, level):
    current_neuron.level = max(level, current_neuron.level)
    for child in sorted(current_neuron.children, key=children level, reverse=True):
        order(child, level + 1)

for input_neuron in input_neurons:
    order(input_neuron, level=0)

(对这个伪代码持保留态度。这正是我直接想到的;它没有经过测试。)

然后您可以按 的顺序计算激活node.level