Package org.nebulaframework.benchmark.scimark2

Examples of org.nebulaframework.benchmark.scimark2.commandline


   
    try {
     
      Parser parser = new Parser();
      parser.setGroup(group);
      CommandLine cmdLine = parser.parse(args);
     
      if (cmdLine.hasOption(helpOpt)) {
        CommandLineUtil.printHelp(group);
        return false;
      }
     
      inputDirectory = new Path((String) cmdLine.getValue(inputDirOpt));
      trainingOutputDirectory = new Path((String) cmdLine.getValue(trainingOutputDirOpt));
      testOutputDirectory = new Path((String) cmdLine.getValue(testOutputDirOpt));
    
      charset = Charset.forName((String) cmdLine.getValue(charsetOpt));

      if (cmdLine.hasOption(testSplitSizeOpt) && cmdLine.hasOption(testSplitPctOpt)) {
        throw new OptionException(testSplitSizeOpt, "must have either split size or split percentage option, not BOTH");
      } else if (!cmdLine.hasOption(testSplitSizeOpt) && !cmdLine.hasOption(testSplitPctOpt)) {
        throw new OptionException(testSplitSizeOpt, "must have either split size or split percentage option");
      }

      if (cmdLine.hasOption(testSplitSizeOpt)) {
        setTestSplitSize(Integer.parseInt((String) cmdLine.getValue(testSplitSizeOpt)));
      }
     
      if (cmdLine.hasOption(testSplitPctOpt)) {
        setTestSplitPct(Integer.parseInt((String) cmdLine.getValue(testSplitPctOpt)));
      }
     
      if (cmdLine.hasOption(splitLocationOpt)) {
        setSplitLocation(Integer.parseInt((String) cmdLine.getValue(splitLocationOpt)));
      }
     
      if (cmdLine.hasOption(randomSelectionSizeOpt)) {
        setTestRandomSelectionSize(Integer.parseInt((String) cmdLine.getValue(randomSelectionSizeOpt)));
      }
     
      if (cmdLine.hasOption(randomSelectionPctOpt)) {
        setTestRandomSelectionPct(Integer.parseInt((String) cmdLine.getValue(randomSelectionPctOpt)));
      }

      fs.mkdirs(trainingOutputDirectory);
      fs.mkdirs(testOutputDirectory);
    
View Full Code Here


      .create();
   
    try {
      Parser parser = new Parser();
      parser.setGroup(group);
      CommandLine cmdLine = parser.parse(args);
     
      if (cmdLine.hasOption(helpOpt)) {
        CommandLineUtil.printHelp(group);
        return;
      }

      File file = new File(cmdLine.getValue(inputOpt).toString());
     
      if (!file.isDirectory()) {
        throw new IllegalArgumentException(file + " does not exist or is not a directory");
      }
     
     
     
      long maxDocs = Long.MAX_VALUE;
      if (cmdLine.hasOption(maxOpt)) {
        maxDocs = Long.parseLong(cmdLine.getValue(maxOpt).toString());
      }
     
      if (maxDocs < 0) {
        throw new IllegalArgumentException("maxDocs must be >= 0");
      }

      String field = cmdLine.getValue(fieldOpt).toString();

      PrintWriter out = null;
      if (cmdLine.hasOption(outputOpt)) {
        out = new PrintWriter(new FileWriter(cmdLine.getValue(outputOpt).toString()));
      }
      else {
        out = new PrintWriter(new OutputStreamWriter(System.out, "UTF-8"));
      }
     
View Full Code Here

   
    Parser parser = new Parser();
    parser.setGroup(group);
   
    try {
      CommandLine cmdLine = parser.parse(args);
     
      if (cmdLine.hasOption(helpOpt)) {
        CommandLineUtil.printHelp(group);
        return;
      }
     
      File file;
      file = new File(cmdLine.getValue(wikipediaFileOpt).toString());
      File[] dumpFiles;
      if (file.isDirectory()) {
        dumpFiles = file.listFiles(new FilenameFilter() {
          public boolean accept(File file, String s) {
            return s.startsWith("freebase-segment-");
          }
        });
      } else {
        dumpFiles = new File[] {file};
      }
     
      int numDocs = Integer.MAX_VALUE;
      if (cmdLine.hasOption(numDocsOpt)) {
        numDocs = Integer.parseInt(cmdLine.getValue(numDocsOpt).toString());
      }
      String url = DEFAULT_SOLR_URL;
      if (cmdLine.hasOption(solrURLOpt)) {
        url = cmdLine.getValue(solrURLOpt).toString();
      }
      int batch = 100;
      if (cmdLine.hasOption(solrBatchOpt)) {
        batch = Integer.parseInt(cmdLine.getValue(solrBatchOpt).toString());
      }
      WikipediaWexIndexer indexer = new WikipediaWexIndexer(
          new CommonsHttpSolrServer(url));
      int total = 0;
      for (int i = 0; i < dumpFiles.length && total < numDocs; i++) {
View Full Code Here

    try {
      Parser parser = new Parser();
     
      parser.setGroup(group);
      parser.setHelpOption(helpOpt);
      CommandLine cmdLine = parser.parse(args);
      if (cmdLine.hasOption(helpOpt)) {
        CommandLineUtil.printHelp(group);
        return;
      }
     
      String classifierType = (String) cmdLine.getValue(typeOpt);
     
      int gramSize = 1;
      if (cmdLine.hasOption(gramSizeOpt)) {
        gramSize = Integer.parseInt((String) cmdLine.getValue(gramSizeOpt));
      }

      String inputPath  = (String) cmdLine.getValue(inputDirOpt);
      String outputPath = (String) cmdLine.getValue(outputOpt);
      TrainMoreLikeThis trainer = new TrainMoreLikeThis();
      MatchMode mode;
     
      if ("knn".equalsIgnoreCase(classifierType)) {
        mode = MatchMode.KNN;
View Full Code Here

      .create();
   
    try {
      Parser parser = new Parser();
      parser.setGroup(group);
      CommandLine cmdLine = parser.parse(args);
     
      if (cmdLine.hasOption(helpOpt)) {
        CommandLineUtil.printHelp(group);
        return;
      }

      File inputDir = new File(cmdLine.getValue(inputOpt).toString());
     
      if (!inputDir.isDirectory()) {
        throw new IllegalArgumentException(inputDir + " does not exist or is not a directory");
      }
     
      long maxDocs = Long.MAX_VALUE;
      if (cmdLine.hasOption(maxOpt)) {
        maxDocs = Long.parseLong(cmdLine.getValue(maxOpt).toString());
      }
     
      if (maxDocs < 0) {
        throw new IllegalArgumentException("maxDocs must be >= 0");
      }

      String field = cmdLine.getValue(fieldOpt).toString();

      PrintWriter out = null;
      if (cmdLine.hasOption(outputOpt)) {
        out = new PrintWriter(new FileWriter(cmdLine.getValue(outputOpt).toString()));
      }
      else {
        out = new PrintWriter(new OutputStreamWriter(System.out, "UTF-8"));
      }
View Full Code Here

        .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);
View Full Code Here

    Group group = gbuilder.withName("Options").withOption(inputOpt).withOption(outputOpt).withOption(labelOpt)
        .withOption(analyzerOpt).withOption(charsetOpt).withOption(collapseOpt).withOption(helpOpt).create();
    try {
      Parser parser = new Parser();
      parser.setGroup(group);
      CommandLine cmdLine = parser.parse(args);
     
      if (cmdLine.hasOption(helpOpt)) {
       
        return;
      }
      File input = new File((String) cmdLine.getValue(inputOpt));
      File output = new File((String) cmdLine.getValue(outputOpt));
      String label = (String) cmdLine.getValue(labelOpt);
      Analyzer analyzer;
      if (cmdLine.hasOption(analyzerOpt)) {
        analyzer = Class.forName((String) cmdLine.getValue(analyzerOpt)).asSubclass(Analyzer.class).newInstance();
      } else {
        analyzer = new StandardAnalyzer(Version.LUCENE_CURRENT);
      }
      Charset charset = Charset.forName("UTF-8");
      if (cmdLine.hasOption(charsetOpt)) {
        charset = Charset.forName((String) cmdLine.getValue(charsetOpt));
      }
      boolean collapse = cmdLine.hasOption(collapseOpt);
     
      if (collapse) {
        collapse(label, analyzer, input, charset, output);
      } else {
        format(label, analyzer, input, charset, output);
View Full Code Here

      descriptorOpt).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 dataPath = cmdLine.getValue(pathOpt).toString();
      String descPath = cmdLine.getValue(descPathOpt).toString();
      List<String> descriptor = convert(cmdLine.getValues(descriptorOpt));
     
      log.debug("Data path : {}", dataPath);
      log.debug("Descriptor path : {}", descPath);
      log.debug("Descriptor : {}", descriptor);
     
View Full Code Here

      outputOpt).withOption(maxHeapSizeOpt).withOption(numGroupsOpt).withOption(methodOpt).withOption(
      encodingOpt).withOption(helpOpt).withOption(treeCacheOpt).withOption(recordSplitterOpt).create();
    try {
      Parser parser = new Parser();
      parser.setGroup(group);
      CommandLine cmdLine = parser.parse(args);
     
      if (cmdLine.hasOption(helpOpt)) {
        CommandLineUtil.printHelp(group);
        return;
      }
     
      Parameters params = new Parameters();
     
      if (cmdLine.hasOption(minSupportOpt)) {
        String minSupportString = (String) cmdLine.getValue(minSupportOpt);
        params.set("minSupport", minSupportString);
      }
      if (cmdLine.hasOption(maxHeapSizeOpt)) {
        String maxHeapSizeString = (String) cmdLine.getValue(maxHeapSizeOpt);
        params.set("maxHeapSize", maxHeapSizeString);
      }
      if (cmdLine.hasOption(numGroupsOpt)) {
        String numGroupsString = (String) cmdLine.getValue(numGroupsOpt);
        params.set("numGroups", numGroupsString);
      }
     
      if (cmdLine.hasOption(treeCacheOpt)) {
        String numTreeCacheString = (String) cmdLine.getValue(treeCacheOpt);
        params.set("treeCacheSize", numTreeCacheString);
      }
     
      if (cmdLine.hasOption(recordSplitterOpt)) {
        String patternString = (String) cmdLine.getValue(recordSplitterOpt);
        params.set("splitPattern", patternString);
      }
     
      String encoding = "UTF-8";
      if (cmdLine.hasOption(encodingOpt)) {
        encoding = (String) cmdLine.getValue(encodingOpt);
      }
      params.set("encoding", encoding);
      String inputDir = (String) cmdLine.getValue(inputDirOpt);
      String outputDir = (String) cmdLine.getValue(outputOpt);
     
      params.set("input", inputDir);
      params.set("output", outputDir);
     
      String classificationMethod = (String) cmdLine.getValue(methodOpt);
      if (classificationMethod.equalsIgnoreCase("sequential")) {
        runFPGrowth(params);
      } else if (classificationMethod.equalsIgnoreCase("mapreduce")) {
        HadoopUtil.overwriteOutput(outputDir);
        PFPGrowth.runPFPGrowth(params);
View Full Code Here

      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);
View Full Code Here

TOP

Related Classes of org.nebulaframework.benchmark.scimark2.commandline

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.