Package org.apache.mahout.common

Examples of org.apache.mahout.common.Parameters


    int i = 0;
    for (Pair<String,Long> e : PFPGrowth.readFList(context.getConfiguration())) {
      fMap.put(e.getFirst(), i++);
    }
   
    Parameters params =
      new Parameters(context.getConfiguration().get(PFPGrowth.PFP_PARAMETERS, ""));

    splitter = Pattern.compile(params.get(PFPGrowth.SPLIT_PATTERN,
                                          PFPGrowth.SPLITTER.toString()));
   
    numGroups = Integer.valueOf(params.getInt(PFPGrowth.NUM_GROUPS,
                                              PFPGrowth.NUM_GROUPS_DEFAULT));
    maxPerGroup = Integer.valueOf(params.getInt(PFPGrowth.MAX_PER_GROUP, 0));
  }
View Full Code Here


      sigmaJSigmaK = stringifier.fromString(sigmaJSigmaKString);
     
      String vocabCountString = job.get("cnaivebayes.vocabCount", stringifier.toString(vocabCount));
      vocabCount = stringifier.fromString(vocabCountString);
     
      Parameters params = new Parameters(job.get("bayes.parameters", ""));
      alphaI = Double.valueOf(params.get("alpha_i", "1.0"));
     
    } catch (IOException ex) {
      log.warn(ex.toString(), ex);
    }
  }
View Full Code Here

     
      String vocabCountString = stringifier.toString(vocabCount);
      vocabCountString = job.get("cnaivebayes.vocabCount", vocabCountString);
      vocabCount = stringifier.fromString(vocabCountString);
     
      Parameters params = new Parameters(job.get("bayes.parameters", ""));
      alphaI = Double.valueOf(params.get("alpha_i", "1.0"));
     
    } catch (IOException ex) {
      log.warn(ex.toString(), ex);
    }
  }
View Full Code Here

    if (parseArguments(args) == null) {
      return -1;
    }

    Parameters params = new Parameters();

    if (hasOption("minSupport")) {
      String minSupportString = getOption("minSupport");
      params.set("minSupport", minSupportString);
    }
    if (hasOption("maxHeapSize")) {
      String maxHeapSizeString = getOption("maxHeapSize");
      params.set("maxHeapSize", maxHeapSizeString);
    }
    if (hasOption("numGroups")) {
      String numGroupsString = getOption("numGroups");
      params.set("numGroups", numGroupsString);
    }

    if (hasOption("numTreeCacheEntries")) {
      String numTreeCacheString = getOption("numTreeCacheEntries");
      params.set("treeCacheSize", numTreeCacheString);
    }

    if (hasOption("splitterPattern")) {
      String patternString = getOption("splitterPattern");
      params.set("splitPattern", patternString);
    }

    String encoding = "UTF-8";
    if (hasOption("encoding")) {
      encoding = getOption("encoding");
    }
    params.set("encoding", encoding);

    if (hasOption("useFPG2")) {
      params.set(PFPGrowth.USE_FPG2, "true");
    }

    Path inputDir = getInputPath();
    Path outputDir = getOutputPath();

    params.set("input", inputDir.toString());
    params.set("output", outputDir.toString());

    String classificationMethod = getOption("method");
    if ("sequential".equalsIgnoreCase(classificationMethod)) {
      runFPGrowth(params);
    } else if ("mapreduce".equalsIgnoreCase(classificationMethod)) {
View Full Code Here

 
  @Override
  protected void setup(Context context) throws IOException, InterruptedException {
   
    super.setup(context);
    Parameters params = new Parameters(context.getConfiguration().get(PFPGrowth.PFP_PARAMETERS, ""));
   
    int i = 0;
    for (Pair<String,Long> e : PFPGrowth.readFList(context.getConfiguration())) {
      featureReverseMap.add(e.getFirst());
      freqList.add(e.getSecond());
    }
   
    maxHeapSize = Integer.valueOf(params.get(PFPGrowth.MAX_HEAPSIZE, "50"));
    minSupport = Integer.valueOf(params.get(PFPGrowth.MIN_SUPPORT, "3"));

    maxPerGroup= params.getInt(PFPGrowth.MAX_PER_GROUP, 0);
    numFeatures= featureReverseMap.size();
    useFP2 = "true".equals(params.get(PFPGrowth.USE_FPG2));
  }
View Full Code Here

  }

  @Override
  public void configure(JobConf job) {
    try {
      Parameters params = Parameters.fromString(job.get("bayes.parameters", ""));
      log.info("Bayes Parameter {}", params.print());
      minSupport = Integer.valueOf(params.get("minSupport", DEFAULT_MIN_SUPPORT));
      minDf      = Integer.valueOf(params.get("minDf", DEFAULT_MIN_DF));
    } catch (IOException ex) {
      log.warn(ex.toString(), ex);
    }
  }
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;
      }
     
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", ""));
      alphaI = Double.valueOf(params.get("alpha_i", "1.0"));
     
    } catch (IOException ex) {
      log.warn(ex.toString(), ex);
    }
  }
View Full Code Here

  }
 
  @Override
  public void configure(JobConf job) {
    try {
      Parameters params = Parameters.fromString(job.get("bayes.parameters", ""));
      log.info("Bayes Parameter {}", params.print());
      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 {
      Parameters params = Parameters.fromString(job.get("bayes.parameters", ""));
      log.info("Bayes Parameter {}", params.print());
      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

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.