Package org.apache.mahout.common

Examples of org.apache.mahout.common.Parameters


  }
 
  @Override
  protected void setup(Context context) throws IOException, InterruptedException {
    super.setup(context);
    Parameters params = new Parameters(context.getConfiguration().get(PFPGrowth.PFP_PARAMETERS, ""));
    splitter = Pattern.compile(params.get(PFPGrowth.SPLIT_PATTERN, PFPGrowth.SPLITTER.toString()));
  }
View Full Code Here


  }
 
  @Override
  protected void setup(Context context) throws IOException, InterruptedException {
    super.setup(context);
    Parameters params = new Parameters(context.getConfiguration().get("job.parameters", ""));
    maxTransactionLength = Integer.valueOf(params.get("maxTransactionLength", "100"));
  }
View Full Code Here

  }
 
  @Override
  protected void setup(Context context) throws IOException, InterruptedException {
    super.setup(context);
    Parameters params = new Parameters(context.getConfiguration().get("job.parameters", ""));
    splitter = Pattern.compile(params.get("splitPattern", "[ \t]*\t[ \t]*"));
   
    int selectedFieldCount = Integer.valueOf(params.get("selectedFieldCount", "0"));
    selectedFields = new int[selectedFieldCount];
    for (int i = 0; i < selectedFieldCount; i++) {
      selectedFields[i] = Integer.valueOf(params.get("field" + i, "0"));
    }
   
    int groupingFieldCount = Integer.valueOf(params.get("groupingFieldCount", "0"));
    groupingFields = new int[groupingFieldCount];
    for (int i = 0; i < groupingFieldCount; i++) {
      groupingFields[i] = Integer.valueOf(params.get("gfield" + i, "0"));
    }
   
  }
View Full Code Here

     
      if (cmdLine.hasOption(helpOpt)) {
        CommandLineUtil.printHelp(group);
        return;
      }
      Parameters params = new Parameters();
      if (cmdLine.hasOption(recordSplitterOpt)) {
        params.set("splitPattern", (String) cmdLine.getValue(recordSplitterOpt));
      }
     
      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);
      params.set("groupingFieldCount", "2");
      params.set("gfield0", "1");
      params.set("gfield1", "2");
      params.set("selectedFieldCount", "1");
      params.set("field0", "3");
      params.set("maxTransactionLength", "100");
      KeyBasedStringTupleGrouper.startJob(params);
     
    } catch (OptionException ex) {
      CommandLineUtil.printHelp(group);
    }
View Full Code Here

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

  @Override
  public void configure(JobConf job) {
    try {
      System.out.println("Bayes Parameter" + job.get("bayes.parameters"));
      Parameters params = Parameters.fromString(job.get("bayes.parameters",""));
      gramSize = Integer.valueOf(params.get("gramSize"));

    } catch (IOException ex) {
      log.warn(ex.toString(), ex);
    }
  }
View Full Code Here

  @Override
  public void configure(JobConf job) {
    try {
      log.info("Bayes Parameter" + job.get("bayes.parameters"));
      Parameters params = Parameters.fromString(job.get("bayes.parameters", ""));
      log.info("{}", params.print());
      Algorithm algorithm;
      Datastore datastore;

     
      if (params.get("dataSource").equals("hdfs")) {
        if (params.get("classifierType").equalsIgnoreCase("bayes")) {
          log.info("Testing Bayes Classifier");
          algorithm = new BayesAlgorithm();
          datastore = new InMemoryBayesDatastore(params);
        } else if (params.get("classifierType").equalsIgnoreCase("cbayes")) {
          log.info("Testing Complementary Bayes Classifier");
          algorithm = new CBayesAlgorithm();
          datastore = new InMemoryBayesDatastore(params);
        } else {
          throw new IllegalArgumentException("Unrecognized classifier type: "
              + params.get("classifierType"));
        }

      } else if (params.get("dataSource").equals("hbase")) {
        if (params.get("classifierType").equalsIgnoreCase("bayes")) {
          log.info("Testing Bayes Classifier");
          algorithm = new BayesAlgorithm();
          datastore = new HBaseBayesDatastore(params.get("basePath"), params);
        } else if (params.get("classifierType").equalsIgnoreCase("cbayes")) {
          log.info("Testing Complementary Bayes Classifier");
          algorithm = new CBayesAlgorithm();
          datastore = new HBaseBayesDatastore(params.get("basePath"), params);
        } else {
          throw new IllegalArgumentException("Unrecognized classifier type: "
              + params.get("classifierType"));
        }

      } else {
        throw new IllegalArgumentException("Unrecognized dataSource type: "
            + params.get("dataSource"));
      }
      classifier = new ClassifierContext(algorithm, datastore);
      classifier.initialize();
     
     
      defaultCategory = params.get("defaultCat");
      gramSize = Integer.valueOf(params.get("gramSize"));
    } catch (IOException ex) {
      log.warn(ex.toString(), ex);
    } catch (InvalidDatastoreException e) {
      log.error(e.toString(), e);
    }
View Full Code Here

  }

  @Override
  public void configure(JobConf job) {
    try {
      Parameters params = Parameters
          .fromString(job.get("bayes.parameters", ""));
      if (params.get("dataSource").equals("hbase"))
        useHbase = true;
      else
        return;

      HBaseConfiguration HBconf = new HBaseConfiguration(job);
View Full Code Here

  }

  @Override
  public void configure(JobConf job) {
    try {
      Parameters params = Parameters
          .fromString(job.get("bayes.parameters", ""));
      if (params.get("dataSource").equals("hbase"))
        useHbase = true;
      else
        return;

      HBaseConfiguration HBconf = new HBaseConfiguration(job);
View Full Code Here

        String vocabCountString = stringifier.toString(vocabCount);
        vocabCountString = job.get("cnaivebayes.vocabCount", vocabCountString);
        vocabCount = stringifier.fromString(vocabCountString);
       
        Parameters params = Parameters.fromString(job.get("bayes.parameters", ""));
        alpha_i = Double.valueOf(params.get("alpha_i", "1.0"));

      }
    } catch (IOException ex) {
      log.warn(ex.toString(), ex);
    }
View Full Code Here

TOP

Related Classes of org.apache.mahout.common.Parameters

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.