Neural network 进化算法不';似乎没有任何进展

Neural network 进化算法不';似乎没有任何进展,neural-network,genetic-algorithm,evolutionary-algorithm,Neural Network,Genetic Algorithm,Evolutionary Algorithm,我正试图对值进行进化以调整它们,但我觉得我的代码不够好。我最大的问题是,这些值的范围是从-5到.5,这使得很难了解来自哪个家长的信息。(顺便说一句,我进化的是神经网络中的权重) def mutate_数组(self、inher1、inher2): shape=inher1.shape 随机_值=2*np.random.rand(*形状)-1 突变=np.random.rand(*shape)

我正试图对值进行进化以调整它们,但我觉得我的代码不够好。我最大的问题是,这些值的范围是从-5到.5,这使得很难了解来自哪个家长的信息。(顺便说一句,我进化的是神经网络中的权重)

def mutate_数组(self、inher1、inher2):
shape=inher1.shape
随机_值=2*np.random.rand(*形状)-1
突变=np.random.rand(*shape)一次机会=(np.random.rand(*shape)很难理解你在问什么。到底是什么问题?预期的行为是什么,实际的行为是什么?“完全失败”没有真正的帮助。很难理解你在问什么。到底是什么问题?预期的行为是什么,实际的行为是什么?“完全失败”没有真正的帮助。
def mutate_array(self, inher1, inher2):

    shape = inher1.shape
    random_values = 2 * np.random.rand(*shape) - 1
    mutatings = np.random.rand(*shape) < self.entropy
    one_chance = (np.random.rand(*shape) <= 0.5)
    new_values = np.array(inher2)
    new_values[one_chance] = np.array(inher1[one_chance])
    new_values[mutatings] += random_values[mutatings]
    return new_values