public static void main(String[] args) throws Exception {
		Options opts = new Options();
		CmdLineParser parser = new CmdLineParser(SPLAMLearner.class, opts);
		Task task = null;
		try {
			parser.parse(args);
			task = Task.get(opts.task);
			if (opts.numKnots < 0) {
				throw new IllegalArgumentException("Number of knots must be positive.");
			}
		} catch (IllegalArgumentException e) {
			parser.printUsage();
			System.exit(1);
		}

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

		SPLAMLearner learner = new SPLAMLearner();
		learner.setNumKnots(opts.numKnots);
		learner.setMaxNumIters(opts.maxNumIters);
		learner.setLambda(opts.lambda);
		learner.setAlpha(opts.alpha);
		learner.setTask(task);
		learner.setVerbose(opts.verbose);

		long start = System.currentTimeMillis();
		GAM gam = learner.build(trainSet);
		long end = System.currentTimeMillis();
		System.out.println("Time: " + (end - start) / 1000.0);
		
		if (opts.outputModelPath != null) {
			PredictorWriter.write(gam, opts.outputModelPath);
		}
	}