public static void main(String[] args) throws Exception {
		Options opts = new Options();
		CmdLineParser parser = new CmdLineParser(RandomForestLearner.class, opts);
		RandomRegressionTreeLearner rtLearner = new RandomRegressionTreeLearner();
		try {
			parser.parse(args);
			String[] data = opts.mode.split(":");
			if (data.length != 2) {
				throw new IllegalArgumentException();
			}
			switch (data[0]) {
				case "a":
					rtLearner.setConstructionMode(Mode.ALPHA_LIMITED);
					rtLearner.setAlpha(Double.parseDouble(data[1]));
					break;
				case "d":
					rtLearner.setConstructionMode(Mode.DEPTH_LIMITED);
					rtLearner.setMaxDepth(Integer.parseInt(data[1]));
					break;
				case "l":
					rtLearner.setConstructionMode(Mode.NUM_LEAVES_LIMITED);
					rtLearner.setMaxNumLeaves(Integer.parseInt(data[1]));
					break;
				case "s":
					rtLearner.setConstructionMode(Mode.MIN_LEAF_SIZE_LIMITED);
					rtLearner.setMinLeafSize(Integer.parseInt(data[1]));
				default:
					throw new IllegalArgumentException();
			}
		} catch (IllegalArgumentException e) {
			parser.printUsage();
			System.exit(1);
		}

		Instances trainSet = InstancesReader.read(opts.attPath, opts.trainPath);

		rtLearner.setNumFeatures(opts.numFeatures);
		RandomForestLearner rfLearner = new RandomForestLearner();
		rfLearner.setBaggingIterations(opts.baggingIters);
		rfLearner.setRegressionTreeLearner(rtLearner);
		rfLearner.setVerbose(opts.verbose);
		
		long start = System.currentTimeMillis();
		RandomForest rf = rfLearner.build(trainSet);
		long end = System.currentTimeMillis();
		System.out.println("Time: " + (end - start) / 1000.0 + " (s).");

		if (opts.outputModelPath != null) {
			PredictorWriter.write(rf, opts.outputModelPath);
		}
	}