public static void main(String[] args) throws Exception {
		if (args.length != 2) {
			System.out.println("Incorrect number of arguments");
			System.exit(0);
		}
		FileReader f = new FileReader(args[0]);
		BufferedReader br = new BufferedReader(f);
		ArrayList<String[]> data = new ArrayList<String[]>();
		int rCount = 0;
		int plus, minus;
		plus = minus = 0;
		String line = br.readLine();
		String[] title = line.split(",");
		while ((line = br.readLine()) != null) {
			String[] row = line.split(",");
			String key = row[row.length-1];
			if (key.equals("yes") || key.equals("A"))
				plus++;
			else
				minus++;
			rCount++;
			data.add(row);
		}
		br.close();
		System.out.println("["+plus+"+/"+minus+"-]");
		boolean result = false;
		if (plus > minus)
			result = true;
		TreeNode classifier = generateTree(data, title, result, -1, 0);
		
		//train
		System.out.print("error (train): ");
		errorRate(data, rCount, classifier);
		
		//test
		FileReader t = new FileReader(args[1]);
		br = new BufferedReader(t);
		ArrayList<String[]> test = new ArrayList<String[]>();
		int rTest = 0;
		line = br.readLine();
		while ((line = br.readLine()) != null) {
			String[] row = line.split(",");
			rTest++;
			test.add(row);
		}
		br.close();
		
		System.out.print("error (test): ");
		errorRate(test, rTest, classifier);
		
	}