public static void main(String[] args) throws Exception {
DefaultOptionBuilder obuilder = new DefaultOptionBuilder();
ArgumentBuilder abuilder = new ArgumentBuilder();
GroupBuilder gbuilder = new GroupBuilder();
Option inputOpt = obuilder.withLongName("input").withRequired(true).withArgument(
abuilder.withName("input").withMinimum(1).withMaximum(1).create()).withDescription(
"The Path for input Vectors. Must be a SequenceFile of Writable, Vector").withShortName("i").create();
Option clustersOpt = obuilder.withLongName("clusters").withRequired(true).withArgument(
abuilder.withName("clusters").withMinimum(1).withMaximum(1).create()).withDescription(
"The input centroids, as Vectors. Must be a SequenceFile of Writable, Cluster/Canopy. "
+ "If k is also specified, then a random set of vectors will be selected"
+ " and written out to this path first").withShortName("c").create();
Option kOpt = obuilder.withLongName("k").withRequired(false).withArgument(
abuilder.withName("k").withMinimum(1).withMaximum(1).create()).withDescription(
"The k in k-Means. If specified, then a random selection of k Vectors will be chosen"
+ " as the Centroid and written to the clusters output path.").withShortName("k").create();
Option outputOpt = obuilder.withLongName("output").withRequired(true).withArgument(
abuilder.withName("output").withMinimum(1).withMaximum(1).create()).withDescription(
"The Path to put the output in").withShortName("o").create();
Option measureClassOpt = obuilder.withLongName("distance").withRequired(false).withArgument(
abuilder.withName("distance").withMinimum(1).withMaximum(1).create()).withDescription(
"The Distance Measure to use. Default is SquaredEuclidean").withShortName("dm").create();
Option convergenceDeltaOpt = obuilder.withLongName("convergence").withRequired(false).withArgument(
abuilder.withName("convergence").withMinimum(1).withMaximum(1).create()).withDescription(
"The threshold below which the clusters are considered to be converged. Default is 0.5")
.withShortName("d").create();
Option maxIterationsOpt = obuilder.withLongName("max").withRequired(false).withArgument(
abuilder.withName("max").withMinimum(1).withMaximum(1).create()).withDescription(
"The maximum number of iterations to perform. Default is 20").withShortName("x").create();
Option vectorClassOpt = obuilder.withLongName("vectorClass").withRequired(false).withArgument(
abuilder.withName("vectorClass").withMinimum(1).withMaximum(1).create()).withDescription(
"The Vector implementation class name. Default is RandomAccessSparseVector.class").withShortName("v")
.create();
Option helpOpt = obuilder.withLongName("help").withDescription("Print out help").withShortName("h")
.create();
Option overwriteOutput = obuilder.withLongName("overwrite").withRequired(false).withDescription(
"If set, overwrite the output directory").withShortName("w").create();
Option clusteringOpt = obuilder.withLongName("clustering").withRequired(false).withDescription(
"If true, run clustering only (assumes the iterations have already taken place").withShortName("l")
.create();
Option mOpt = obuilder.withLongName("m").withRequired(true).withArgument(
abuilder.withName("m").withMinimum(1).withMaximum(1).create()).withDescription(
"coefficient normalization factor, must be greater than 1").withShortName("m").create();
Option numReduceTasksOpt = obuilder.withLongName("numReduce").withRequired(false).withArgument(
abuilder.withName("numReduce").withMinimum(1).withMaximum(1).create()).withDescription(
"The number of reduce tasks").withShortName("r").create();
Option numMapTasksOpt = obuilder.withLongName("numMap").withRequired(false).withArgument(
abuilder.withName("numMap").withMinimum(1).withMaximum(1).create()).withDescription(
"The number of map tasks").withShortName("u").create();
Group group = gbuilder.withName("Options").withOption(inputOpt).withOption(clustersOpt).withOption(
outputOpt).withOption(measureClassOpt).withOption(convergenceDeltaOpt).withOption(maxIterationsOpt)