if (args.length < 4 || (args.length > 4 && args.length != 7)) {
System.out
.println("USAGE: <INPUT_PATH> <OUTPUT_PATH> <MAXITERATIONS> <K (how many centers)> -g [<COUNT> <DIMENSION OF VECTORS>]");
return;
}
HamaConfiguration conf = new HamaConfiguration();
Path in = new Path(args[0]);
Path out = new Path(args[1]);
FileSystem fs = FileSystem.get(conf);
Path center = null;
if (fs.isFile(in)) {
center = new Path(in.getParent(), "center/cen.seq");
} else {
center = new Path(in, "center/cen.seq");
}
Path centerOut = new Path(out, "center/center_output.seq");
conf.set(KMeansBSP.CENTER_IN_PATH, center.toString());
conf.set(KMeansBSP.CENTER_OUT_PATH, centerOut.toString());
int iterations = Integer.parseInt(args[2]);
conf.setInt(KMeansBSP.MAX_ITERATIONS_KEY, iterations);
int k = Integer.parseInt(args[3]);
if (args.length == 7 && args[4].equals("-g")) {
int count = Integer.parseInt(args[5]);
if (k > count)
throw new IllegalArgumentException("K can't be greater than n!");