public boolean update(double[] data, boolean classifier) {
		double sum = 0;
		
		//create a new data vector to encompass all data points plus classifier
		double[] vector = new double[data.length+1];
		double norm = 1;
		for (int i = 0; i < data.length; i++) {
			vector[i] = data[i];
			norm += data[i]*data[i];
		}
		//x_n+1 = -1
		
		vector[vector.length-1] = -1;
		
		norm = Math.sqrt(norm);
		//If the classifier is false, map x to -x.
		if (!classifier) {
			norm*=-1;
		}
		//normalize data vector
		for (int i = 0; i < vector.length; i++) {
			vector[i] = vector[i]/norm;
		}
		
		if (vector.length != weights.length) {
			System.err.println("Error: Perceptron must be the same lenghts as features + classifier");
			return false;
		}
		for (int i = 0; i < weights.length; i++) {
			sum += weights[i]*vector[i];
		}
		//System.out.println("Sum: "+sum);
		if (sum > 0) {
			
			return true;
		}
		//update weights
		for (int i = 0; i < weights.length; i++) {
			weights[i]+=vector[i];
		}
		return false;
	}