Examples of Algorithm


Examples of org.apache.lucene.benchmark.byTask.utils.Algorithm

  /** Test the repetiotion parsing for parallel tasks */
  public void testParseParallelTaskSequenceRepetition() throws Exception {
    String taskStr = "AddDoc";
    String parsedTasks = "[ "+taskStr+" ] : 1000";
    Benchmark benchmark = new Benchmark(new StringReader(propPart+parsedTasks));
    Algorithm alg = benchmark.getAlgorithm();
    ArrayList<PerfTask> algTasks = alg.extractTasks();
    boolean foundAdd = false;
    for (final PerfTask task : algTasks) {
       if (task.toString().indexOf(taskStr)>=0) {
          foundAdd = true;
       }
       if (task instanceof TaskSequence) {
         assertEquals("repetions should be 1000 for "+parsedTasks, 1000, ((TaskSequence) task).getRepetitions());
         assertTrue("sequence for "+parsedTasks+" should be parallel!", ((TaskSequence) task).isParallel());
       }
       assertTrue("Task "+taskStr+" was not found in "+alg.toString(),foundAdd);
    }
  }
View Full Code Here

Examples of org.apache.lucene.benchmark.byTask.utils.Algorithm

  /** Test the repetiotion parsing for sequential  tasks */
  public void testParseTaskSequenceRepetition() throws Exception {
    String taskStr = "AddDoc";
    String parsedTasks = "{ "+taskStr+" } : 1000";
    Benchmark benchmark = new Benchmark(new StringReader(propPart+parsedTasks));
    Algorithm alg = benchmark.getAlgorithm();
    ArrayList<PerfTask> algTasks = alg.extractTasks();
    boolean foundAdd = false;
    for (final PerfTask task : algTasks) {
       if (task.toString().indexOf(taskStr)>=0) {
          foundAdd = true;
       }
       if (task instanceof TaskSequence) {
         assertEquals("repetions should be 1000 for "+parsedTasks, 1000, ((TaskSequence) task).getRepetitions());
         assertFalse("sequence for "+parsedTasks+" should be sequential!", ((TaskSequence) task).isParallel());
       }
       assertTrue("Task "+taskStr+" was not found in "+alg.toString(),foundAdd);
    }
  }
View Full Code Here

Examples of org.apache.lucene.benchmark.byTask.utils.Algorithm

        if (config.get("query.maker", null) != null) {
          Class.forName(config.get("query.maker", null));
          config.set("query.maker", MockQueryMaker.class.getName());
        }
        PerfRunData data = new PerfRunData(config);
        new Algorithm(data);
      } catch (Throwable t) {
        t.printStackTrace();
        fail("Could not parse sample file: " + algFile + " reason:"
            + t.getClass() + ":" + t.getMessage());
      }
View Full Code Here

Examples of org.apache.lucene.benchmark.byTask.utils.Algorithm

      throw new Exception("Error: cannot init PerfRunData!",e);
    }
   
    // parse algorithm
    try {
      algorithm = new Algorithm(runData);
    } catch (Exception e) {
      throw new Exception("Error: cannot understand algorithm!",e);
    }
  }
View Full Code Here

Examples of org.apache.mahout.classifier.bayes.Algorithm

    try {
      //<start id="mahout.bayes.setup"/>
      BayesParameters p = new BayesParameters();
      p.set("basePath", modelDir.getCanonicalPath());
      Datastore ds = new InMemoryBayesDatastore(p);
      Algorithm a  = new BayesAlgorithm();
      ClassifierContext ctx = new ClassifierContext(a,ds);
      ctx.initialize();
      //<end id="mahout.bayes.setup"/>
      synchronized (swapContext) {
          this.ctx = ctx; // swap upon successful load.
View Full Code Here

Examples of org.apache.mahout.classifier.bayes.Algorithm

      }
     
      BayesParameters p = new BayesParameters();
      p.set("basePath", modelDir.getCanonicalPath());
      Datastore ds = new InMemoryBayesDatastore(p);
      Algorithm a  = new BayesAlgorithm();
      ClassifierContext ctx = new ClassifierContext(a,ds);
      ctx.initialize();
     
      //TODO: make the analyzer configurable
      StandardAnalyzer analyzer = new StandardAnalyzer(Version.LUCENE_36);
View Full Code Here

Examples of org.apache.mahout.classifier.bayes.interfaces.Algorithm

      public boolean accept(File file, String s) {
        return s.startsWith(".") == false;
      }
    });
   
    Algorithm algorithm;
    Datastore datastore;
   
    if (params.get("dataSource").equals("hdfs")) {
      if (params.get("classifierType").equalsIgnoreCase("bayes")) {
        log.info("Testing Bayes Classifier");
View Full Code Here

Examples of org.apache.mahout.classifier.bayes.interfaces.Algorithm

   
    String modelBasePath = (String) cmdLine.getValue(pathOpt);
   
    log.info("Loading model from: {}", params.print());
   
    Algorithm algorithm;
    Datastore datastore;
   
    String classifierType = (String) cmdLine.getValue(typeOpt);
   
    String dataSource = (String) cmdLine.getValue(dataSourceOpt);
View Full Code Here

Examples of org.apache.mahout.classifier.bayes.interfaces.Algorithm

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

Examples of org.apache.mahout.classifier.bayes.interfaces.Algorithm

    params.set("dataSource", "hdfs");
    params.set("defaultCat", "unknown");
    params.set("encoding", "UTF-8");
    params.set("alpha_i", "1.0");
   
    Algorithm algorithm = new BayesAlgorithm();
    Datastore datastore = new InMemoryBayesDatastore(params);
    ClassifierContext classifier = new ClassifierContext(algorithm, datastore);
    classifier.initialize();
    ResultAnalyzer resultAnalyzer = new ResultAnalyzer(classifier.getLabels(), params.get("defaultCat"));
   
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.