Example #1
0
class InputNeuron(object):

    def __init__(self, neuron_id = None):
        Neuron.__init__(self)
        self.__id = neuron_id
        self.__local.append(0)
        self.__output.append(0)

    def __accumulate(self, *argin):
        self.__local[0] = argin[0]

    def __activate(self):
        self.__output[0] = self.__local[0]

    def probagate(self, *argin):
        self.__accumulate(*argin)
        self.__activate()
        return self.__output[0]

    def neuronId():
        return self.__id

    def local(self):
        return self.__local

    def output(self):
        return self.__output

Neuron.register(InputNeuron)
Example #2
0
            self.__local[i] = self.__local[i+1]
        self.__local[-1] = sum(argin)

    def __activate(self):
        if not len(self.__local):
            return
        output = 0.0
        
        if self.activate_mode == 'Logistic':
            output = 1.0 / (1.0 + exp(-self.__local[-1]))

        for i in range(self.__num - 1):
            self.__output[i] = self.__output[i+1]
        self.__output[-1] = output

    def probagate(self, *argin):
        self.__accumulate(*argin)
        self.__activate()
        return self.__output[-1]

    def neuronId():
        return self.__id

    def local(self):
        return self.__local

    def output(self):
        return self.__output

Neuron.register(Perceptron)
Example #3
0
class InputNeuron(object):
    def __init__(self, neuron_id=None):
        Neuron.__init__(self)
        self.__id = neuron_id
        self.__local.append(0)
        self.__output.append(0)

    def __accumulate(self, *argin):
        self.__local[0] = argin[0]

    def __activate(self):
        self.__output[0] = self.__local[0]

    def probagate(self, *argin):
        self.__accumulate(*argin)
        self.__activate()
        return self.__output[0]

    def neuronId():
        return self.__id

    def local(self):
        return self.__local

    def output(self):
        return self.__output


Neuron.register(InputNeuron)