Ejemplo n.º 1
0
    def __init__(self, rate, *layout):
        FFNeuralBrain.__init__(self, rate, *layout)
        if len(self.layout) < 4:
            raise RuntimeError("At least 2 hidden layers\
                                are required for recurrent networking!")

        n_feedbackers = int(len(self.hiddens[-1]) * (FEEDBACKERS_PERCENT / 100))
        self.feedbackers = self.hiddens[-1][:n_feedbackers]

        self.inputs = [RNeuron(self, None, False) for _ in range(layout[0])]
        self.hiddens = [[RNeuron(self, inp, True)
                         for _ in range(n)]
                        for n in layout[1:-1]]
        self.outputs = [RNeuron(self, self.hiddens[-1], False) for _ in range(layout[-1])]
Ejemplo n.º 2
0
 def think(self, stimuli):
     stimuli = list(stimuli) + [neuron.output for neuron in self.feedbackers]
     return FFNeuralBrain.think(self, stimuli)