from collections import namedtuple
import math
import aimath


class FeedForwardNet:
    def __init__(self):
        pass

class Layer:
    def __init__(self):
        pass

    def connect_neurons(self, neuron1, neuron2, weight=1):
        connection = Connection(neuron1, neuron2, weight)
        neuron1.attach_forward(connection)
        neuron2.attach_back(connection)

class Neuron:
    def __init__(self):
        self._forward = []
        self._back = []
        self._signal = 0
        self._errsignal = 0
        self._learningrate = 0

    @property
    def signal(self):
        return self._signal

    @property
    def errsignal(self):
        return self._errsignal

    def attach_forward(self, connection):
        self._forward.append(connection)

    def attach_back(self, connection):
        self._back.append(connection)

    def propagate(self):
        thesum = 0
        for b in self._back:
            thesum += b.weight * b.signal
        self._signal = aimath.sigmoid(thesum)

    def backpropagate1(self):
        thesum = 0
        for f in self._forward:
            thesum += f.weight * f.errsignal
        self._errsignal = thesum

    def backpropogate2(self):
        a = self._learningrate
        b = self._errsignal
        c = aimath.sigmoidprime(self._signal)
        dweight = a * b * c

        for b in back:
            b.weight += dweight

class Connection:
    def __init__(self, forward, back, weight):
        self._forward = forward
        self._back = back
        self._weight = weight

    @property
    def weight(self):
        return self._weight

    @weight.setter
    def weight(self, value):
        self._weight = value

    @property
    def signal(self):
        return back.signal

    @property
    def errsignal(self):
        return forward.errsignal

@@ -150,31 +150,305 @@
 t__(self
-):%0A        pass
+, num_neurons):%0A        self._neurons = %5BNeuron() for x in range(num_neurons)%5D%0A%0A    @property%0A    def neurons(self):%0A        return self._neurons%0A%0A    def connect_layer(self, other):%0A        for n in self._neurons:%0A            for m in other.neurons:%0A                _connect_neurons(n, m)
 %0A%0A    de
@@ -441,32 +441,33 @@
 (n, m)%0A%0A    def 
+_
 connect_neurons(
@@ -643,16 +643,256 @@
 ction)%0A%0A
+    def propagate(self):%0A        for n in self._neurons:%0A            n.propagate()%0A%0A    def backpropagate(self):%0A        for n in self._neurons:%0A            n.backpropagate1()%0A        for n in self._neurons:%0A            n.backpropagate2()%0A%0A
 class Ne

Implement Layer class