public void learn(double[] expectedOutputs) {
		this.learningCycles++;
		double sum = 0;
		double error = 0;
		double weight = 0;
		
		//Last layer
		int lastLayer = layers.length - 1;
		for(int j = 0; j < layers[lastLayer].getSize(); j++) {
			
			for(int k = 0; k < layers[lastLayer].getNeuron(j).getInputSize(); k++){
				//Multiply by derivative of 1/(1+exp(-x))
				double delta = layers[lastLayer].getNeuron(j).lastOutput() * (1 - layers[lastLayer].getNeuron(j).lastOutput()) * (expectedOutputs[j] - layers[lastLayer].getNeuron(j).lastOutput());
				
				layers[lastLayer].getNeuron(j).setError(delta);				
				layers[lastLayer].getNeuron(j).setWeight(k, layers[lastLayer].getNeuron(j).getWeight(k) + learningRate * layers[lastLayer].getNeuron(j).getError() * layers[lastLayer].getNeuron(j).getLastInput(k));
			}
		}
		
		//Other layers
		for(int i = layers.length - 2; i >= 0; i--){
			for(int j = 0; j < layers[i].getSize(); j++) {
				
				//Get error
				sum = 0;
				for(int k = 0; k < layers[i+1].getSize(); k++){
					error = layers[i+1].getNeuron(k).getError();
					weight = layers[i+1].getNeuron(k).getWeight(j);
					sum += error * weight; 
				}
				
				for(int k = 0; k < layers[i].getNeuron(j).getInputSize(); k++){
					//Multiply by derivative of 1/(1+exp(-x))
					double delta = layers[i].getNeuron(j).lastOutput() * (1 - layers[i].getNeuron(j).lastOutput()) * sum;
					
					layers[i].getNeuron(j).setError(delta);				
					layers[i].getNeuron(j).setWeight(k, layers[i].getNeuron(j).getWeight(k) + learningRate * layers[i].getNeuron(j).getError() * layers[i].getNeuron(j).getLastInput(k));
				}
			}
		}
	}