public void train(Pattern p) {

		// propagate; set activation Values
		this.propagate(p, false);
		// run over all Layers from the bottom to the top; Except the Input
		// Layer
		// Backpropagation
		for (int i = neurons.size() - 1; i > 0; i--) {

			for (int s = 0; s < neurons.get(i).size(); s++) {

				Neuron neuron = neurons.get(i).get(s);
				if (neuron.getNeuronType() == ENeuronType.Output) {
					neuron.calculateDeltaFunctionValuesForOutputNeuron(p
							.getOutputNeuronsSet()[s]);
				}
				if (neuron.getNeuronType() == ENeuronType.Hidden) {
					neuron.calculateDeltaFunctionValuesForHiddenNeuron();
				}
				if (neuron.getNeuronType() == ENeuronType.Input) {
					throw new IllegalStateException(
							"Error: Input Neuron in Layer " + i + " found!");
				}
			}
		}

		// Calculate new weights
		for (int i = 1; i < neurons.size(); i++) {
			for (Neuron neuron : neurons.get(i)) {
				neuron.calculateNewWeightsForMyDendrites(learningRate);

			}
		}

	}