Example usage for org.apache.commons.cli2 CommandLine getValue

List of usage examples for org.apache.commons.cli2 CommandLine getValue

Introduction

In this page you can find the example usage for org.apache.commons.cli2 CommandLine getValue.

Prototype

Object getValue(final Option option) throws IllegalStateException;

Source Link

Document

Retrieves the single Argument value associated with the specified Option

Usage

From source file:org.apache.mahout.classifier.df.tools.Frequencies.java

@Override
public int run(String[] args) throws IOException, ClassNotFoundException, InterruptedException {

    DefaultOptionBuilder obuilder = new DefaultOptionBuilder();
    ArgumentBuilder abuilder = new ArgumentBuilder();
    GroupBuilder gbuilder = new GroupBuilder();

    Option dataOpt = obuilder.withLongName("data").withShortName("d").withRequired(true)
            .withArgument(abuilder.withName("path").withMinimum(1).withMaximum(1).create())
            .withDescription("Data path").create();

    Option datasetOpt = obuilder.withLongName("dataset").withShortName("ds").withRequired(true)
            .withArgument(abuilder.withName("path").withMinimum(1).create()).withDescription("dataset path")
            .create();/*from   w  w w.  j a  v a2s .c  om*/

    Option helpOpt = obuilder.withLongName("help").withDescription("Print out help").withShortName("h")
            .create();

    Group group = gbuilder.withName("Options").withOption(dataOpt).withOption(datasetOpt).withOption(helpOpt)
            .create();

    try {
        Parser parser = new Parser();
        parser.setGroup(group);
        CommandLine cmdLine = parser.parse(args);

        if (cmdLine.hasOption(helpOpt)) {
            CommandLineUtil.printHelp(group);
            return 0;
        }

        String dataPath = cmdLine.getValue(dataOpt).toString();
        String datasetPath = cmdLine.getValue(datasetOpt).toString();

        log.debug("Data path : {}", dataPath);
        log.debug("Dataset path : {}", datasetPath);

        runTool(dataPath, datasetPath);
    } catch (OptionException e) {
        log.warn(e.toString(), e);
        CommandLineUtil.printHelp(group);
    }

    return 0;
}

From source file:org.apache.mahout.classifier.df.tools.UDistrib.java

/**
 * Launch the uniform distribution tool. Requires the following command line arguments:<br>
 * //from  w  w w.ja v a  2s  . com
 * data : data path dataset : dataset path numpartitions : num partitions output : output path
 *
 * @throws java.io.IOException
 */
public static void main(String[] args) throws IOException {

    DefaultOptionBuilder obuilder = new DefaultOptionBuilder();
    ArgumentBuilder abuilder = new ArgumentBuilder();
    GroupBuilder gbuilder = new GroupBuilder();

    Option dataOpt = obuilder.withLongName("data").withShortName("d").withRequired(true)
            .withArgument(abuilder.withName("data").withMinimum(1).withMaximum(1).create())
            .withDescription("Data path").create();

    Option datasetOpt = obuilder.withLongName("dataset").withShortName("ds").withRequired(true)
            .withArgument(abuilder.withName("dataset").withMinimum(1).create()).withDescription("Dataset path")
            .create();

    Option outputOpt = obuilder.withLongName("output").withShortName("o").withRequired(true)
            .withArgument(abuilder.withName("output").withMinimum(1).withMaximum(1).create())
            .withDescription("Path to generated files").create();

    Option partitionsOpt = obuilder.withLongName("numpartitions").withShortName("p").withRequired(true)
            .withArgument(abuilder.withName("numparts").withMinimum(1).withMinimum(1).create())
            .withDescription("Number of partitions to create").create();
    Option helpOpt = obuilder.withLongName("help").withDescription("Print out help").withShortName("h")
            .create();

    Group group = gbuilder.withName("Options").withOption(dataOpt).withOption(outputOpt).withOption(datasetOpt)
            .withOption(partitionsOpt).withOption(helpOpt).create();

    try {
        Parser parser = new Parser();
        parser.setGroup(group);
        CommandLine cmdLine = parser.parse(args);

        if (cmdLine.hasOption(helpOpt)) {
            CommandLineUtil.printHelp(group);
            return;
        }

        String data = cmdLine.getValue(dataOpt).toString();
        String dataset = cmdLine.getValue(datasetOpt).toString();
        int numPartitions = Integer.parseInt(cmdLine.getValue(partitionsOpt).toString());
        String output = cmdLine.getValue(outputOpt).toString();

        runTool(data, dataset, output, numPartitions);
    } catch (OptionException e) {
        log.warn(e.toString(), e);
        CommandLineUtil.printHelp(group);
    }

}

From source file:org.apache.mahout.classifier.mlp.TrainMultilayerPerceptron.java

static Double getDouble(CommandLine commandLine, Option option) {
    Object val = commandLine.getValue(option);
    if (val != null) {
        return Double.parseDouble(val.toString());
    }/*  w ww.j a v a 2  s .  co  m*/
    return null;
}

From source file:org.apache.mahout.classifier.mlp.TrainMultilayerPerceptron.java

static String getString(CommandLine commandLine, Option option) {
    Object val = commandLine.getValue(option);
    if (val != null) {
        return val.toString();
    }//www  .  j a v  a  2 s  . com
    return null;
}

From source file:org.apache.mahout.classifier.sequencelearning.hmm.BaumWelchTrainer.java

public static void main(String[] args) throws IOException {
    DefaultOptionBuilder optionBuilder = new DefaultOptionBuilder();
    ArgumentBuilder argumentBuilder = new ArgumentBuilder();

    Option inputOption = DefaultOptionCreator.inputOption().create();

    Option outputOption = DefaultOptionCreator.outputOption().create();

    Option stateNumberOption = optionBuilder.withLongName("nrOfHiddenStates")
            .withDescription("Number of hidden states").withShortName("nh")
            .withArgument(argumentBuilder.withMaximum(1).withMinimum(1).withName("number").create())
            .withRequired(true).create();

    Option observedStateNumberOption = optionBuilder.withLongName("nrOfObservedStates")
            .withDescription("Number of observed states").withShortName("no")
            .withArgument(argumentBuilder.withMaximum(1).withMinimum(1).withName("number").create())
            .withRequired(true).create();

    Option epsilonOption = optionBuilder.withLongName("epsilon").withDescription("Convergence threshold")
            .withShortName("e")
            .withArgument(argumentBuilder.withMaximum(1).withMinimum(1).withName("number").create())
            .withRequired(true).create();

    Option iterationsOption = optionBuilder.withLongName("max-iterations")
            .withDescription("Maximum iterations number").withShortName("m")
            .withArgument(argumentBuilder.withMaximum(1).withMinimum(1).withName("number").create())
            .withRequired(true).create();

    Group optionGroup = new GroupBuilder().withOption(inputOption).withOption(outputOption)
            .withOption(stateNumberOption).withOption(observedStateNumberOption).withOption(epsilonOption)
            .withOption(iterationsOption).withName("Options").create();

    try {// ww w  .j  a v  a2  s.c  om
        Parser parser = new Parser();
        parser.setGroup(optionGroup);
        CommandLine commandLine = parser.parse(args);

        String input = (String) commandLine.getValue(inputOption);
        String output = (String) commandLine.getValue(outputOption);

        int nrOfHiddenStates = Integer.parseInt((String) commandLine.getValue(stateNumberOption));
        int nrOfObservedStates = Integer.parseInt((String) commandLine.getValue(observedStateNumberOption));

        double epsilon = Double.parseDouble((String) commandLine.getValue(epsilonOption));
        int maxIterations = Integer.parseInt((String) commandLine.getValue(iterationsOption));

        //constructing random-generated HMM
        HmmModel model = new HmmModel(nrOfHiddenStates, nrOfObservedStates, new Date().getTime());
        List<Integer> observations = Lists.newArrayList();

        //reading observations
        Scanner scanner = new Scanner(new FileInputStream(input), "UTF-8");
        try {
            while (scanner.hasNextInt()) {
                observations.add(scanner.nextInt());
            }
        } finally {
            scanner.close();
        }

        int[] observationsArray = new int[observations.size()];
        for (int i = 0; i < observations.size(); ++i) {
            observationsArray[i] = observations.get(i);
        }

        //training
        HmmModel trainedModel = HmmTrainer.trainBaumWelch(model, observationsArray, epsilon, maxIterations,
                true);

        //serializing trained model
        DataOutputStream stream = new DataOutputStream(new FileOutputStream(output));
        try {
            LossyHmmSerializer.serialize(trainedModel, stream);
        } finally {
            Closeables.close(stream, false);
        }

        //printing tranied model
        System.out.println("Initial probabilities: ");
        for (int i = 0; i < trainedModel.getNrOfHiddenStates(); ++i) {
            System.out.print(i + " ");
        }
        System.out.println();
        for (int i = 0; i < trainedModel.getNrOfHiddenStates(); ++i) {
            System.out.print(trainedModel.getInitialProbabilities().get(i) + " ");
        }
        System.out.println();

        System.out.println("Transition matrix:");
        System.out.print("  ");
        for (int i = 0; i < trainedModel.getNrOfHiddenStates(); ++i) {
            System.out.print(i + " ");
        }
        System.out.println();
        for (int i = 0; i < trainedModel.getNrOfHiddenStates(); ++i) {
            System.out.print(i + " ");
            for (int j = 0; j < trainedModel.getNrOfHiddenStates(); ++j) {
                System.out.print(trainedModel.getTransitionMatrix().get(i, j) + " ");
            }
            System.out.println();
        }
        System.out.println("Emission matrix: ");
        System.out.print("  ");
        for (int i = 0; i < trainedModel.getNrOfOutputStates(); ++i) {
            System.out.print(i + " ");
        }
        System.out.println();
        for (int i = 0; i < trainedModel.getNrOfHiddenStates(); ++i) {
            System.out.print(i + " ");
            for (int j = 0; j < trainedModel.getNrOfOutputStates(); ++j) {
                System.out.print(trainedModel.getEmissionMatrix().get(i, j) + " ");
            }
            System.out.println();
        }
    } catch (OptionException e) {
        CommandLineUtil.printHelp(optionGroup);
    }
}

From source file:org.apache.mahout.classifier.sequencelearning.hmm.hadoop.BaumWelchDriver.java

@Override
public int run(String[] args) throws Exception {

    DefaultOptionBuilder optionBuilder = new DefaultOptionBuilder();
    ArgumentBuilder argumentBuilder = new ArgumentBuilder();

    Option inputOption = optionBuilder.withLongName("input")
            .withDescription("Sequence file containing VectorWritables as training sequence").withShortName("i")
            .withArgument(argumentBuilder.withMaximum(1).withMinimum(1).withName("path").create())
            .withRequired(true).create();

    Option outputOption = optionBuilder.withLongName("output")
            .withDescription("Output path to store the trained model encoded as Sequence Files")
            .withShortName("o")
            .withArgument(argumentBuilder.withMaximum(1).withMinimum(1).withName("path").create())
            .withRequired(true).create();

    Option modelOption = optionBuilder.withLongName("model")
            .withDescription("Initial HmmModel encoded as a Sequence File. "
                    + "Will be constructed with a random distribution if the 'buildRandom' option is set to true.")
            .withShortName("im")
            .withArgument(argumentBuilder.withMaximum(1).withMinimum(1).withName("path").create())
            .withRequired(false).create();

    Option hiddenStateMapPath = optionBuilder.withLongName("hiddenStateToIDMap")
            .withDescription("Hidden states to ID map path.").withShortName("hmap")
            .withArgument(argumentBuilder.withMaximum(1).withMinimum(1).withName("path").create())
            .withRequired(true).create();

    Option emitStateMapPath = optionBuilder.withLongName("emittedStateToIDMap")
            .withDescription("Emitted states to ID map path.").withShortName("smap")
            .withArgument(argumentBuilder.withMaximum(1).withMinimum(1).withName("path").create())
            .withRequired(true).create();

    Option randomOption = optionBuilder.withLongName("buildRandom")
            .withDescription(//from  w  w  w. j  a v  a 2 s . c om
                    "Optional argument to generate a random initial HmmModel and store it in 'model' directory")
            .withShortName("r")
            .withArgument(argumentBuilder.withMaximum(1).withMinimum(1).withName("boolean").create())
            .withRequired(false).create();

    Option scalingOption = optionBuilder.withLongName("Scaling")
            .withDescription("Optional argument to invoke scaled training").withShortName("l")
            .withArgument(argumentBuilder.withMaximum(1).withMinimum(1).withName("string").create())
            .withRequired(true).create();

    Option stateNumberOption = optionBuilder.withLongName("nrOfHiddenStates")
            .withDescription("Number of hidden states").withShortName("nh")
            .withArgument(argumentBuilder.withMaximum(1).withMinimum(1).withName("number").create())
            .withRequired(true).create();

    Option observedStateNumberOption = optionBuilder.withLongName("nrOfObservedStates")
            .withDescription("Number of observed states").withShortName("no")
            .withArgument(argumentBuilder.withMaximum(1).withMinimum(1).withName("number").create())
            .withRequired(true).create();

    Option epsilonOption = optionBuilder.withLongName("epsilon").withDescription("Convergence threshold")
            .withShortName("e")
            .withArgument(argumentBuilder.withMaximum(1).withMinimum(1).withName("number").create())
            .withRequired(true).create();

    Option iterationsOption = optionBuilder.withLongName("maxIterations")
            .withDescription("Maximum iterations number").withShortName("m")
            .withArgument(argumentBuilder.withMaximum(1).withMinimum(1).withName("number").create())
            .withRequired(true).create();

    Group optionGroup = new GroupBuilder().withOption(inputOption).withOption(outputOption)
            .withOption(modelOption).withOption(hiddenStateMapPath).withOption(emitStateMapPath)
            .withOption(randomOption).withOption(scalingOption).withOption(stateNumberOption)
            .withOption(observedStateNumberOption).withOption(epsilonOption).withOption(iterationsOption)
            .withName("Options").create();

    try {
        Parser parser = new Parser();
        parser.setGroup(optionGroup);
        CommandLine commandLine = parser.parse(args);

        String input = (String) commandLine.getValue(inputOption);
        String output = (String) commandLine.getValue(outputOption);
        String modelIn = (String) commandLine.getValue(modelOption);
        String hiddenStateToIdMap = (String) commandLine.getValue(hiddenStateMapPath);
        String emittedStateToIdMap = (String) commandLine.getValue(emitStateMapPath);

        Boolean buildRandom = commandLine.hasOption(randomOption);
        String scaling = (String) commandLine.getValue(scalingOption);

        int numHidden = Integer.parseInt((String) commandLine.getValue(stateNumberOption));
        int numObserved = Integer.parseInt((String) commandLine.getValue(observedStateNumberOption));

        double convergenceDelta = Double.parseDouble((String) commandLine.getValue(epsilonOption));
        int maxIterations = Integer.parseInt((String) commandLine.getValue(iterationsOption));

        if (getConf() == null) {
            setConf(new Configuration());
        }
        if (buildRandom) {

            BaumWelchUtils.buildRandomModel(numHidden, numObserved, new Path(modelIn), getConf());
        }
        run(getConf(), new Path(input), new Path(modelIn), new Path(output), new Path(hiddenStateToIdMap),
                new Path(emittedStateToIdMap), numHidden, numObserved, convergenceDelta, scaling,
                maxIterations);
    } catch (OptionException e) {
        CommandLineUtil.printHelp(optionGroup);
    }

    return 0;

}

From source file:org.apache.mahout.classifier.sequencelearning.hmm.RandomSequenceGenerator.java

public static void main(String[] args) throws IOException {
    DefaultOptionBuilder optionBuilder = new DefaultOptionBuilder();
    ArgumentBuilder argumentBuilder = new ArgumentBuilder();

    Option outputOption = optionBuilder.withLongName("output")
            .withDescription("Output file with sequence of observed states").withShortName("o")
            .withArgument(argumentBuilder.withMaximum(1).withMinimum(1).withName("path").create())
            .withRequired(false).create();

    Option modelOption = optionBuilder.withLongName("model").withDescription("Path to serialized HMM model")
            .withShortName("m")
            .withArgument(argumentBuilder.withMaximum(1).withMinimum(1).withName("path").create())
            .withRequired(true).create();

    Option lengthOption = optionBuilder.withLongName("length").withDescription("Length of generated sequence")
            .withShortName("l")
            .withArgument(argumentBuilder.withMaximum(1).withMinimum(1).withName("number").create())
            .withRequired(true).create();

    Group optionGroup = new GroupBuilder().withOption(outputOption).withOption(modelOption)
            .withOption(lengthOption).withName("Options").create();

    try {//  w w w.  jav a 2  s.  c  om
        Parser parser = new Parser();
        parser.setGroup(optionGroup);
        CommandLine commandLine = parser.parse(args);

        String output = (String) commandLine.getValue(outputOption);

        String modelPath = (String) commandLine.getValue(modelOption);

        int length = Integer.parseInt((String) commandLine.getValue(lengthOption));

        //reading serialized HMM
        DataInputStream modelStream = new DataInputStream(new FileInputStream(modelPath));
        HmmModel model;
        try {
            model = LossyHmmSerializer.deserialize(modelStream);
        } finally {
            Closeables.close(modelStream, true);
        }

        //generating observations
        int[] observations = HmmEvaluator.predict(model, length, System.currentTimeMillis());

        //writing output
        PrintWriter writer = new PrintWriter(
                new OutputStreamWriter(new FileOutputStream(output), Charsets.UTF_8), true);
        try {
            for (int observation : observations) {
                writer.print(observation);
                writer.print(' ');
            }
        } finally {
            Closeables.close(writer, false);
        }
    } catch (OptionException e) {
        CommandLineUtil.printHelp(optionGroup);
    }
}

From source file:org.apache.mahout.classifier.sequencelearning.hmm.ViterbiEvaluator.java

public static void main(String[] args) throws IOException {
    DefaultOptionBuilder optionBuilder = new DefaultOptionBuilder();
    ArgumentBuilder argumentBuilder = new ArgumentBuilder();

    Option inputOption = DefaultOptionCreator.inputOption().create();

    Option outputOption = DefaultOptionCreator.outputOption().create();

    Option modelOption = optionBuilder.withLongName("model").withDescription("Path to serialized HMM model")
            .withShortName("m")
            .withArgument(argumentBuilder.withMaximum(1).withMinimum(1).withName("path").create())
            .withRequired(true).create();

    Option likelihoodOption = optionBuilder.withLongName("likelihood")
            .withDescription("Compute likelihood of observed sequence").withShortName("l").withRequired(false)
            .create();//from w w  w .  ja  v a 2s.c  o  m

    Group optionGroup = new GroupBuilder().withOption(inputOption).withOption(outputOption)
            .withOption(modelOption).withOption(likelihoodOption).withName("Options").create();

    try {
        Parser parser = new Parser();
        parser.setGroup(optionGroup);
        CommandLine commandLine = parser.parse(args);

        String input = (String) commandLine.getValue(inputOption);
        String output = (String) commandLine.getValue(outputOption);

        String modelPath = (String) commandLine.getValue(modelOption);

        boolean computeLikelihood = commandLine.hasOption(likelihoodOption);

        //reading serialized HMM
        DataInputStream modelStream = new DataInputStream(new FileInputStream(modelPath));
        HmmModel model;
        try {
            model = LossyHmmSerializer.deserialize(modelStream);
        } finally {
            Closeables.close(modelStream, true);
        }

        //reading observations
        List<Integer> observations = Lists.newArrayList();
        Scanner scanner = new Scanner(new FileInputStream(input), "UTF-8");
        try {
            while (scanner.hasNextInt()) {
                observations.add(scanner.nextInt());
            }
        } finally {
            scanner.close();
        }

        int[] observationsArray = new int[observations.size()];
        for (int i = 0; i < observations.size(); ++i) {
            observationsArray[i] = observations.get(i);
        }

        //decoding
        int[] hiddenStates = HmmEvaluator.decode(model, observationsArray, true);

        //writing output
        PrintWriter writer = new PrintWriter(
                new OutputStreamWriter(new FileOutputStream(output), Charsets.UTF_8), true);
        try {
            for (int hiddenState : hiddenStates) {
                writer.print(hiddenState);
                writer.print(' ');
            }
        } finally {
            Closeables.close(writer, false);
        }

        if (computeLikelihood) {
            System.out.println("Likelihood: " + HmmEvaluator.modelLikelihood(model, observationsArray, true));
        }
    } catch (OptionException e) {
        CommandLineUtil.printHelp(optionGroup);
    }
}

From source file:org.apache.mahout.classifier.sgd.TestASFEmail.java

boolean parseArgs(String[] args) {
    DefaultOptionBuilder builder = new DefaultOptionBuilder();

    Option help = builder.withLongName("help").withDescription("print this list").create();

    ArgumentBuilder argumentBuilder = new ArgumentBuilder();
    Option inputFileOption = builder.withLongName("input").withRequired(true)
            .withArgument(argumentBuilder.withName("input").withMaximum(1).create())
            .withDescription("where to get training data").create();

    Option modelFileOption = builder.withLongName("model").withRequired(true)
            .withArgument(argumentBuilder.withName("model").withMaximum(1).create())
            .withDescription("where to get a model").create();

    Group normalArgs = new GroupBuilder().withOption(help).withOption(inputFileOption)
            .withOption(modelFileOption).create();

    Parser parser = new Parser();
    parser.setHelpOption(help);/*w  w w .j  a  v a  2  s .c om*/
    parser.setHelpTrigger("--help");
    parser.setGroup(normalArgs);
    parser.setHelpFormatter(new HelpFormatter(" ", "", " ", 130));
    CommandLine cmdLine = parser.parseAndHelp(args);

    if (cmdLine == null) {
        return false;
    }

    inputFile = (String) cmdLine.getValue(inputFileOption);
    modelFile = (String) cmdLine.getValue(modelFileOption);
    return true;
}

From source file:org.apache.mahout.classifier.sgd.TrainAdaptiveLogistic.java

private static boolean parseArgs(String[] args) {
    DefaultOptionBuilder builder = new DefaultOptionBuilder();

    Option help = builder.withLongName("help").withDescription("print this list").create();

    Option quiet = builder.withLongName("quiet").withDescription("be extra quiet").create();

    ArgumentBuilder argumentBuilder = new ArgumentBuilder();
    Option showperf = builder.withLongName("showperf")
            .withDescription("output performance measures during training").create();

    Option inputFile = builder.withLongName("input").withRequired(true)
            .withArgument(argumentBuilder.withName("input").withMaximum(1).create())
            .withDescription("where to get training data").create();

    Option outputFile = builder.withLongName("output").withRequired(true)
            .withArgument(argumentBuilder.withName("output").withMaximum(1).create())
            .withDescription("where to write the model content").create();

    Option threads = builder.withLongName("threads")
            .withArgument(argumentBuilder.withName("threads").withDefault("4").create())
            .withDescription("the number of threads AdaptiveLogisticRegression uses").create();

    Option predictors = builder.withLongName("predictors").withRequired(true)
            .withArgument(argumentBuilder.withName("predictors").create())
            .withDescription("a list of predictor variables").create();

    Option types = builder.withLongName("types").withRequired(true)
            .withArgument(argumentBuilder.withName("types").create())
            .withDescription("a list of predictor variable types (numeric, word, or text)").create();

    Option target = builder.withLongName("target").withDescription("the name of the target variable")
            .withRequired(true).withArgument(argumentBuilder.withName("target").withMaximum(1).create())
            .create();/*from  www . java2s  . c  o  m*/

    Option targetCategories = builder.withLongName("categories")
            .withDescription("the number of target categories to be considered").withRequired(true)
            .withArgument(argumentBuilder.withName("categories").withMaximum(1).create()).create();

    Option features = builder.withLongName("features")
            .withDescription("the number of internal hashed features to use")
            .withArgument(argumentBuilder.withName("numFeatures").withDefault("1000").withMaximum(1).create())
            .create();

    Option passes = builder.withLongName("passes")
            .withDescription("the number of times to pass over the input data")
            .withArgument(argumentBuilder.withName("passes").withDefault("2").withMaximum(1).create()).create();

    Option interval = builder.withLongName("interval")
            .withArgument(argumentBuilder.withName("interval").withDefault("500").create())
            .withDescription("the interval property of AdaptiveLogisticRegression").create();

    Option window = builder.withLongName("window")
            .withArgument(argumentBuilder.withName("window").withDefault("800").create())
            .withDescription("the average propery of AdaptiveLogisticRegression").create();

    Option skipperfnum = builder.withLongName("skipperfnum")
            .withArgument(argumentBuilder.withName("skipperfnum").withDefault("99").create())
            .withDescription("show performance measures every (skipperfnum + 1) rows").create();

    Option prior = builder.withLongName("prior")
            .withArgument(argumentBuilder.withName("prior").withDefault("L1").create())
            .withDescription("the prior algorithm to use: L1, L2, ebp, tp, up").create();

    Option priorOption = builder.withLongName("prioroption")
            .withArgument(argumentBuilder.withName("prioroption").create())
            .withDescription("constructor parameter for ElasticBandPrior and TPrior").create();

    Option auc = builder.withLongName("auc")
            .withArgument(argumentBuilder.withName("auc").withDefault("global").create())
            .withDescription("the auc to use: global or grouped").create();

    Group normalArgs = new GroupBuilder().withOption(help).withOption(quiet).withOption(inputFile)
            .withOption(outputFile).withOption(target).withOption(targetCategories).withOption(predictors)
            .withOption(types).withOption(passes).withOption(interval).withOption(window).withOption(threads)
            .withOption(prior).withOption(features).withOption(showperf).withOption(skipperfnum)
            .withOption(priorOption).withOption(auc).create();

    Parser parser = new Parser();
    parser.setHelpOption(help);
    parser.setHelpTrigger("--help");
    parser.setGroup(normalArgs);
    parser.setHelpFormatter(new HelpFormatter(" ", "", " ", 130));
    CommandLine cmdLine = parser.parseAndHelp(args);

    if (cmdLine == null) {
        return false;
    }

    TrainAdaptiveLogistic.inputFile = getStringArgument(cmdLine, inputFile);
    TrainAdaptiveLogistic.outputFile = getStringArgument(cmdLine, outputFile);

    List<String> typeList = Lists.newArrayList();
    for (Object x : cmdLine.getValues(types)) {
        typeList.add(x.toString());
    }

    List<String> predictorList = Lists.newArrayList();
    for (Object x : cmdLine.getValues(predictors)) {
        predictorList.add(x.toString());
    }

    lmp = new AdaptiveLogisticModelParameters();
    lmp.setTargetVariable(getStringArgument(cmdLine, target));
    lmp.setMaxTargetCategories(getIntegerArgument(cmdLine, targetCategories));
    lmp.setNumFeatures(getIntegerArgument(cmdLine, features));
    lmp.setInterval(getIntegerArgument(cmdLine, interval));
    lmp.setAverageWindow(getIntegerArgument(cmdLine, window));
    lmp.setThreads(getIntegerArgument(cmdLine, threads));
    lmp.setAuc(getStringArgument(cmdLine, auc));
    lmp.setPrior(getStringArgument(cmdLine, prior));
    if (cmdLine.getValue(priorOption) != null) {
        lmp.setPriorOption(getDoubleArgument(cmdLine, priorOption));
    }
    lmp.setTypeMap(predictorList, typeList);
    TrainAdaptiveLogistic.showperf = getBooleanArgument(cmdLine, showperf);
    TrainAdaptiveLogistic.skipperfnum = getIntegerArgument(cmdLine, skipperfnum);
    TrainAdaptiveLogistic.passes = getIntegerArgument(cmdLine, passes);

    lmp.checkParameters();

    return true;
}