List of usage examples for weka.core Option description
public String description()
From source file:TextDirectoryLoader.java
License:Open Source License
/** * Main method./* ww w .j a v a 2 s . c o m*/ * * @param args should contain the name of an input file. */ public static void main(String[] args) { if (args.length > 0) { try { TextDirectoryLoader loader = new TextDirectoryLoader(); loader.setOptions(args); System.out.println(loader.getDataSet()); } catch (Exception e) { e.printStackTrace(); } } else { System.err.println("\nUsage:\n" + "\tTextDirectoryLoader [options]\n" + "\n" + "Options:\n"); Enumeration enm = ((OptionHandler) new TextDirectoryLoader()).listOptions(); while (enm.hasMoreElements()) { Option option = (Option) enm.nextElement(); System.err.println(option.synopsis()); System.err.println(option.description()); } System.err.println(); } }
From source file:bme.mace.logicdomain.Evaluation.java
License:Open Source License
/** * Make up the help string giving all the command line options * /*w ww. j a v a 2s . co m*/ * @param classifier the classifier to include options for * @param globalInfo include the global information string for the classifier * (if available). * @return a string detailing the valid command line options */ protected static String makeOptionString(Classifier classifier, boolean globalInfo) { StringBuffer optionsText = new StringBuffer(""); // General options optionsText.append("\n\nGeneral options:\n\n"); optionsText.append("-h or -help\n"); optionsText.append("\tOutput help information.\n"); optionsText.append("-synopsis or -info\n"); optionsText.append("\tOutput synopsis for classifier (use in conjunction " + " with -h)\n"); optionsText.append("-t <name of training file>\n"); optionsText.append("\tSets training file.\n"); optionsText.append("-T <name of test file>\n"); optionsText.append("\tSets test file. If missing, a cross-validation will be performed\n"); optionsText.append("\ton the training data.\n"); optionsText.append("-c <class index>\n"); optionsText.append("\tSets index of class attribute (default: last).\n"); optionsText.append("-x <number of folds>\n"); optionsText.append("\tSets number of folds for cross-validation (default: 10).\n"); optionsText.append("-no-cv\n"); optionsText.append("\tDo not perform any cross validation.\n"); optionsText.append("-split-percentage <percentage>\n"); optionsText.append("\tSets the percentage for the train/test set split, e.g., 66.\n"); optionsText.append("-preserve-order\n"); optionsText.append("\tPreserves the order in the percentage split.\n"); optionsText.append("-s <random number seed>\n"); optionsText.append("\tSets random number seed for cross-validation or percentage split\n"); optionsText.append("\t(default: 1).\n"); optionsText.append("-m <name of file with cost matrix>\n"); optionsText.append("\tSets file with cost matrix.\n"); optionsText.append("-l <name of input file>\n"); optionsText.append("\tSets model input file. In case the filename ends with '.xml',\n"); optionsText.append("\ta PMML file is loaded or, if that fails, options are loaded\n"); optionsText.append("\tfrom the XML file.\n"); optionsText.append("-d <name of output file>\n"); optionsText.append("\tSets model output file. In case the filename ends with '.xml',\n"); optionsText.append("\tonly the options are saved to the XML file, not the model.\n"); optionsText.append("-v\n"); optionsText.append("\tOutputs no statistics for training data.\n"); optionsText.append("-o\n"); optionsText.append("\tOutputs statistics only, not the classifier.\n"); optionsText.append("-i\n"); optionsText.append("\tOutputs detailed information-retrieval"); optionsText.append(" statistics for each class.\n"); optionsText.append("-k\n"); optionsText.append("\tOutputs information-theoretic statistics.\n"); optionsText.append("-p <attribute range>\n"); optionsText.append("\tOnly outputs predictions for test instances (or the train\n" + "\tinstances if no test instances provided and -no-cv is used),\n" + "\talong with attributes (0 for none).\n"); optionsText.append("-distribution\n"); optionsText.append("\tOutputs the distribution instead of only the prediction\n"); optionsText.append("\tin conjunction with the '-p' option (only nominal classes).\n"); optionsText.append("-r\n"); optionsText.append("\tOnly outputs cumulative margin distribution.\n"); if (classifier instanceof Sourcable) { optionsText.append("-z <class name>\n"); optionsText.append("\tOnly outputs the source representation" + " of the classifier,\n\tgiving it the supplied" + " name.\n"); } if (classifier instanceof Drawable) { optionsText.append("-g\n"); optionsText.append("\tOnly outputs the graph representation" + " of the classifier.\n"); } optionsText.append("-xml filename | xml-string\n"); optionsText.append("\tRetrieves the options from the XML-data instead of the " + "command line.\n"); optionsText.append("-threshold-file <file>\n"); optionsText.append("\tThe file to save the threshold data to.\n" + "\tThe format is determined by the extensions, e.g., '.arff' for ARFF \n" + "\tformat or '.csv' for CSV.\n"); optionsText.append("-threshold-label <label>\n"); optionsText.append( "\tThe class label to determine the threshold data for\n" + "\t(default is the first label)\n"); // Get scheme-specific options if (classifier instanceof OptionHandler) { optionsText.append("\nOptions specific to " + classifier.getClass().getName() + ":\n\n"); Enumeration enu = ((OptionHandler) classifier).listOptions(); while (enu.hasMoreElements()) { Option option = (Option) enu.nextElement(); optionsText.append(option.synopsis() + '\n'); optionsText.append(option.description() + "\n"); } } // Get global information (if available) if (globalInfo) { try { String gi = getGlobalInfo(classifier); optionsText.append(gi); } catch (Exception ex) { // quietly ignore } } return optionsText.toString(); }
From source file:cba.AssociatorEvaluation.java
License:Open Source License
/** * Generates an option string to output on the commandline. * /*from w w w. jav a2 s . c om*/ * @param associator the associator to generate the string for * @return the option string */ protected static String makeOptionString(Associator associator) { StringBuffer text; text = new StringBuffer(); // general options text.append("\nGeneral options:\n\n"); text.append("-t <training file>\n"); text.append("\tThe name of the training file.\n"); text.append("-g <name of graph file>\n"); text.append("\tOutputs the graph representation (if supported) of the associator to a file.\n"); // associator specific options, if any if (associator instanceof OptionHandler) { text.append( "\nOptions specific to " + associator.getClass().getName().replaceAll(".*\\.", "") + ":\n\n"); Enumeration enm = ((OptionHandler) associator).listOptions(); while (enm.hasMoreElements()) { Option option = (Option) enm.nextElement(); text.append(option.synopsis() + "\n"); text.append(option.description() + "\n"); } } return text.toString(); }
From source file:com.entopix.maui.main.MauiModelBuilder.java
License:Open Source License
/** * The main method./*from w ww . j a v a 2 s. c o m*/ */ public static void main(String[] ops) { MauiModelBuilder modelBuilder = new MauiModelBuilder(); VocabularyStoreFactory.setPrefferedVocabStoreType(VocabularyStore_HT.class); try { modelBuilder.setOptions(ops); // Output what options are used log.info("Building model with options: "); String[] optionSettings = modelBuilder.getOptions(); String options = ""; for (String optionSetting : optionSettings) { options += optionSetting + " "; } log.info(options); MauiFilter mauiFilter = modelBuilder.buildModel(); log.info("Model built. Saving the model..."); modelBuilder.saveModel(mauiFilter); log.info("Done!"); } catch (Exception e) { // Output information on how to use this class log.error("Error running MauiModelBuilder..", e); log.error(e.getMessage()); log.error("\nOptions:\n"); Enumeration<Option> en = modelBuilder.listOptions(); while (en.hasMoreElements()) { Option option = en.nextElement(); log.error(option.synopsis()); log.error(option.description()); } } }
From source file:com.github.polarisation.kea.main.KEAKeyphraseExtractor.java
License:Open Source License
/** * The main method. //from www .j a v a 2s . c o m */ public static void main(String[] ops) { KEAKeyphraseExtractor kmb = new KEAKeyphraseExtractor(); try { // Checking and Setting Options selected by the user: kmb.setOptions(ops); System.err.print("Extracting keyphrases with options: "); // Reading Options, which were set above and output them: String[] optionSettings = kmb.getOptions(); for (int i = 0; i < optionSettings.length; i++) { System.err.print(optionSettings[i] + " "); } System.err.println(); // Loading selected Model: System.err.println("-- Loading the Model... "); kmb.loadModel(); // Extracting Keyphrases from all files in the selected directory // stem == the name of the file without ".txt" kmb.extractKeyphrases(kmb.collectStems()); } catch (Exception e) { e.printStackTrace(); System.err.println(e.getMessage()); System.err.println("\nOptions:\n"); Enumeration en = kmb.listOptions(); while (en.hasMoreElements()) { Option option = (Option) en.nextElement(); System.err.println(option.synopsis()); System.err.println(option.description()); } } }
From source file:com.openkm.kea.modelcreator.KEAKeyphraseExtractor.java
License:Open Source License
/** * The main method.// w w w .ja va 2 s . c om */ public static void main(String[] ops) { KEAKeyphraseExtractor kmb = new KEAKeyphraseExtractor(new StopwordsEnglish()); try { // Checking and Setting Options selected by the user: kmb.setOptions(ops); log.info("Extracting keyphrases with options: "); // Reading Options, which were set above and output them: String[] optionSettings = kmb.getOptions(); for (int i = 0; i < optionSettings.length; i++) { log.info(optionSettings[i] + " "); } // Loading selected Model: log.info("-- Loading the Model... "); kmb.loadModel(); // Extracting Keyphrases from all files in the selected directory // stem == the name of the file without ".txt" kmb.extractKeyphrases(kmb.collectStems()); } catch (Exception e) { e.printStackTrace(); log.error(e.getMessage()); log.error("\nOptions:\n"); Enumeration<Option> en = kmb.listOptions(); while (en.hasMoreElements()) { Option option = en.nextElement(); log.error(option.synopsis()); log.error(option.description()); } } }
From source file:com.openkm.kea.modelcreator.KEAModelBuilder.java
License:Open Source License
/** * The main method. //from w ww. j a v a 2 s.c om */ public static void main(String[] ops) { KEAModelBuilder kmb = new KEAModelBuilder(); try { kmb.setOptions(ops); log.info("Building model with options: "); String[] optionSettings = kmb.getOptions(); for (int i = 0; i < optionSettings.length; i++) { log.info(optionSettings[i] + " "); } kmb.buildModel(kmb.collectStems(), new StopwordsEnglish()); kmb.saveModel(); } catch (Exception e) { e.printStackTrace(); log.error(e.getMessage()); log.error("\nOptions:\n"); Enumeration<Option> en = kmb.listOptions(); while (en.hasMoreElements()) { Option option = en.nextElement(); log.error(option.synopsis()); log.error(option.description()); } } }
From source file:com.rapidminer.tools.WekaTools.java
License:Open Source License
/** * Tries to guess the type of the given option. If the number of arguments * is zero, than a boolean type is assumed. In other cases it will be tried * to parse the default value in the options array as a number and on * success a Double type is returned. If this fails, a ParameterTypeString * is returned./* w w w. j a v a2s. c om*/ */ public static ParameterType guessParameterType(Option option, String[] options) { if (option.numArguments() == 0) { String defaultString = getStringDefault(option.name(), options); if (defaultString == null) { return new ParameterTypeBoolean(option.name(), option.description(), getBooleanDefault(option.name(), options)); } else { return new ParameterTypeString(option.name(), option.description(), defaultString); } } else { String defaultString = getStringDefault(option.name(), options); if (defaultString == null) { return new ParameterTypeString(option.name(), option.description()); } else { try { double defaultValue = Double.parseDouble(defaultString); return new ParameterTypeDouble(option.name(), option.description(), Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, defaultValue); } catch (NumberFormatException e) { return new ParameterTypeString(option.name(), option.description(), defaultString); } } } }
From source file:core.ClusterEvaluationEX.java
License:Open Source License
/** * Make up the help string giving all the command line options * * @param clusterer the clusterer to include options for * @return a string detailing the valid command line options */// w w w .j ava 2s. c o m private static String makeOptionString(Clusterer clusterer, boolean globalInfo) { StringBuffer optionsText = new StringBuffer(""); // General options optionsText.append("\n\nGeneral options:\n\n"); optionsText.append("-h or -help\n"); optionsText.append("\tOutput help information.\n"); optionsText.append("-synopsis or -info\n"); optionsText.append("\tOutput synopsis for clusterer (use in conjunction " + " with -h)\n"); optionsText.append("-t <name of training file>\n"); optionsText.append("\tSets training file.\n"); optionsText.append("-T <name of test file>\n"); optionsText.append("\tSets test file.\n"); optionsText.append("-l <name of input file>\n"); optionsText.append("\tSets model input file.\n"); optionsText.append("-d <name of output file>\n"); optionsText.append("\tSets model output file.\n"); optionsText.append("-p <attribute range>\n"); optionsText.append("\tOutput predictions. Predictions are for " + "training file" + "\n\tif only training file is specified," + "\n\totherwise predictions are for the test file." + "\n\tThe range specifies attribute values to be output" + "\n\twith the predictions. Use '-p 0' for none.\n"); optionsText.append("-x <number of folds>\n"); optionsText.append("\tOnly Distribution Clusterers can be cross validated.\n"); optionsText.append("-s <random number seed>\n"); optionsText.append("\tSets the seed for randomizing the data in cross-validation\n"); optionsText.append("-c <class index>\n"); optionsText.append("\tSet class attribute. If supplied, class is ignored"); optionsText.append("\n\tduring clustering but is used in a classes to"); optionsText.append("\n\tclusters evaluation.\n"); if (clusterer instanceof Drawable) { optionsText.append("-g <name of graph file>\n"); optionsText.append("\tOutputs the graph representation of the clusterer to the file.\n"); } // Get scheme-specific options if (clusterer instanceof OptionHandler) { optionsText.append("\nOptions specific to " + clusterer.getClass().getName() + ":\n\n"); Enumeration enu = ((OptionHandler) clusterer).listOptions(); while (enu.hasMoreElements()) { Option option = (Option) enu.nextElement(); optionsText.append(option.synopsis() + '\n'); optionsText.append(option.description() + "\n"); } } // Get global information (if available) if (globalInfo) { try { String gi = getGlobalInfo(clusterer); optionsText.append(gi); } catch (Exception ex) { // quietly ignore } } return optionsText.toString(); }
From source file:core.DatabaseSaverEx.java
License:Open Source License
/** * Main method./*from w ww .j a va2 s.co m*/ * * @param options should contain the options of a Saver. */ public static void main(String[] options) { StringBuffer text = new StringBuffer(); text.append("\n\nDatabaseSaver options:\n"); try { DatabaseSaver asv = new DatabaseSaver(); try { Enumeration enumi = asv.listOptions(); while (enumi.hasMoreElements()) { Option option = (Option) enumi.nextElement(); text.append(option.synopsis() + '\n'); text.append(option.description() + '\n'); } asv.setOptions(options); asv.setDestination(); } catch (Exception ex) { ex.printStackTrace(); } //incremental /*asv.setRetrieval(INCREMENTAL); Instances instances = asv.getInstances(); asv.setStructure(instances); for(int i = 0; i < instances.numInstances(); i++){ //last instance is null and finishes incremental saving asv.writeIncremental(instances.instance(i)); } asv.writeIncremental(null);*/ //batch asv.writeBatch(); } catch (Exception ex) { ex.printStackTrace(); System.out.println(text); } }