helpOpt).create();
try {
Parser parser = new Parser();
parser.setGroup(group);
CommandLine cmdLine = parser.parse(args);
if (cmdLine.hasOption(helpOpt)) {
CommandLineUtil.printHelp(group);
return;
}
String input = cmdLine.getValue(inputOpt).toString();
String clusters = cmdLine.getValue(clustersOpt).toString();
String output = cmdLine.getValue(outputOpt).toString();
String measureClass = SquaredEuclideanDistanceMeasure.class.getName();
if (cmdLine.hasOption(measureClassOpt)) {
measureClass = cmdLine.getValue(measureClassOpt).toString();
}
double convergenceDelta = 0.5;
if (cmdLine.hasOption(convergenceDeltaOpt)) {
convergenceDelta = Double.parseDouble(cmdLine.getValue(convergenceDeltaOpt).toString());
}
float m = Float.parseFloat(cmdLine.getValue(mOpt).toString());
// Class<? extends Vector> vectorClass = cmdLine.hasOption(vectorClassOpt) == false ?
// RandomAccessSparseVector.class
// : (Class<? extends Vector>) Class.forName(cmdLine.getValue(vectorClassOpt).toString());
int numReduceTasks = 10;
if (cmdLine.hasOption(numReduceTasksOpt)) {
numReduceTasks = Integer.parseInt(cmdLine.getValue(numReduceTasksOpt).toString());
}
int numMapTasks = 50;
if (cmdLine.hasOption(numMapTasksOpt)) {
numMapTasks = Integer.parseInt(cmdLine.getValue(numMapTasksOpt).toString());
}
int maxIterations = 20;
if (cmdLine.hasOption(maxIterationsOpt)) {
maxIterations = Integer.parseInt(cmdLine.getValue(maxIterationsOpt).toString());
}
if (cmdLine.hasOption(overwriteOutput)) {
HadoopUtil.overwriteOutput(output);
}
if (cmdLine.hasOption(kOpt)) {
clusters = RandomSeedGenerator.buildRandom(input, clusters,
Integer.parseInt(cmdLine.getValue(kOpt).toString())).toString();
}
if (cmdLine.hasOption(clusteringOpt)) {
runClustering(input, clusters, output, measureClass, convergenceDelta, numMapTasks,
m);
} else {
runJob(input, clusters, output, measureClass, convergenceDelta, maxIterations,
numMapTasks, numReduceTasks, m);