private void updateWeights(double[] labels) {
		
		NeuralNode[] outputNodes = _layers[_layers.length - 1].getNodes();
		NeuralNode[] prevNodes = _layers[_layers.length - 2].getNodes();
		for(int i = 0 ; i < prevNodes.length; i++){
			for(int j = 0 ; j < outputNodes.length ; j++){
				double deltaWeight;
				if ((int) labels[0] == j) {
					outputNodes[j].setDelta((1 - outputNodes[j].getOutput())
							* outputNodes[j].getOutput()
							* (1 - outputNodes[j].getOutput()));

					deltaWeight = LEARNING_RATE * outputNodes[j].getDelta()
							* prevNodes[i].getOutput();
				} else {
					outputNodes[j].setDelta((0 - outputNodes[j].getOutput())
							* outputNodes[j].getOutput()
							* (1 - outputNodes[j].getOutput()));

					deltaWeight = LEARNING_RATE * outputNodes[j].getDelta()
							* prevNodes[i].getOutput();
				}
				prevNodes[i].setToUpdate(outputNodes[j], deltaWeight);
			}
		}
		
		for(int layer = _layers.length - 2; layer > 0; layer--){
			NeuralNode[] curNodes = _layers[layer].getNodes();
			prevNodes = _layers[layer - 1].getNodes();
			
			for(int i = 0; i < prevNodes.length; i++){
				double deltaWeight;
				double delta;
				for(int j = 0; j < curNodes.length -1; j++){
					delta = curNodes[j].getDeltaSum() * prevNodes[i].getOutput();
					curNodes[j].setDelta(delta);
					deltaWeight = LEARNING_RATE * delta * prevNodes[i].getOutput();
					prevNodes[i].setToUpdate(curNodes[j], deltaWeight);
				}
			}
		}
		
		for(int layer = 0 ; layer < _layers.length - 1; layer++){
			NeuralNode[] curNodes = _layers[layer].getNodes();
			for(int i = 0 ; i < curNodes.length; i++){
				curNodes[i].update();
			}
		}
	}