Exemplo n.º 1
0
    def activates(self, inputs):
        """Calculates whether or not the neron fires with given inputs.

        :param inputs: Array containing the inputs corresponding to the weights passed to the constructor
        :return: 1 if the neuron fires, 0 if it failed to fire
        """
        total = self.weights[0] * self.bias
        for i in range(len(inputs)):
            total += inputs[i] * self.weights[i + 1]
        return sigmoid(total)
Exemplo n.º 2
0
    def activates(self, inputs):
        """Calculates whether or not the neron fires with given inputs.

        :param inputs: Array containing the inputs corresponding to the weights passed to the constructor
        :return: 1 if the neuron fires, 0 if it failed to fire
        """
        total = self.weights[0] * self.bias
        for i in range(len(inputs)):
            total += inputs[i] * self.weights[i + 1]
        return sigmoid(total)
Exemplo n.º 3
0
 def test_sigmoid(self):
     print(sigmoid(-.4))