'Trains the network with the given data using backpropagation.
The given data is a list of (input, output)-tuples,
where each input and output a list of values.
For example, to learn the XOR-function:
nn = BPNN()
nn._weight_initialization(2, 1, hidden=2)
nn._train([
([0,0], [0]),
([0,1], [1]),
([1,0], [1]),
([1,1], [0])
print(nn._classify([0,0]))
print(nn._classify([0,1]))'

def _train(self, data=[], iterations=1000, rate=0.5, momentum=0.1):

    for i in range(iterations):
        error = 0.0
        for (input, output) in data:
            self._propagate_forward(input)
            error += self._propagate_backward(output, rate, momentum)
