Examples of DummyCandidate


Examples of org.apache.mahout.ga.watchmaker.utils.DummyCandidate

    conf.set(EvalMapper.MAHOUT_GA_EVALUATOR, StringUtils.toString(evaluator));
    mapper.configure(conf);

    // evaluate the population using the mapper
    for (int index = 0; index < population.size(); index++) {
      DummyCandidate candidate = population.get(index);
      mapper.map(new LongWritable(index), new Text(StringUtils
          .toString(candidate)), collector, null);
    }

    // check that the evaluations are correct
    Set<String> keys = collector.getKeys();
    assertEquals("Number of evaluations", populationSize, keys.size());
    for (String key : keys) {
      DummyCandidate candidate = population.get(Integer.parseInt(key));
      assertEquals("Values for key " + key, 1, collector.getValue(key).size());
      double fitness = collector.getValue(key).get(0).get();
      assertEquals("Evaluation of the candidate " + key, DummyEvaluator
          .getFitness(candidate.getIndex()), fitness);
    }
  }
View Full Code Here

Examples of org.apache.mahout.ga.watchmaker.utils.DummyCandidate

    MahoutEvaluator.evaluate(evaluator, population, results);

    // check results
    assertEquals("Number of evaluations", populationSize, results.size());
    for (int index = 0; index < population.size(); index++) {
      DummyCandidate candidate = population.get(index);
      assertEquals("Evaluation of the candidate " + index, DummyEvaluator
          .getFitness(candidate.getIndex()), results.get(index));
    }
  }
View Full Code Here

Examples of org.apache.mahout.ga.watchmaker.utils.DummyCandidate

    MahoutEvaluator.evaluate(evaluator, population, results, input, output);

    // check results
    assertEquals("Number of evaluations", POPULATION_SIZE, results.size());
    for (int index = 0; index < population.size(); index++) {
      DummyCandidate candidate = population.get(index);
      assertEquals("Evaluation of the candidate " + index,
                   DummyEvaluator.getFitness(candidate.getIndex()), results.get(index), EPSILON);
    }
  }
View Full Code Here

Examples of org.apache.mahout.ga.watchmaker.utils.DummyCandidate

    mapper.setup(context);

    // evaluate the population using the mapper
    for (int index = 0; index < population.size(); index++) {
      DummyCandidate candidate = population.get(index);
      mapper.map(new LongWritable(index), new Text(StringUtils.toString(candidate)), context);
    }

    // check that the evaluations are correct
    Set<LongWritable> keys = output.getKeys();
    assertEquals("Number of evaluations", POPULATION_SIZE, keys.size());
    for (LongWritable key : keys) {
      DummyCandidate candidate = population.get((int) key.get());
      assertEquals("Values for key " + key, 1, output.getValue(key).size());
      double fitness = output.getValue(key).get(0).get();
      assertEquals("Evaluation of the candidate " + key,
                   DummyEvaluator.getFitness(candidate.getIndex()),
                   fitness,
                   EPSILON);
    }
  }
View Full Code Here

Examples of org.apache.mahout.ga.watchmaker.utils.DummyCandidate

    MahoutEvaluator.evaluate(evaluator, population, results);

    // check results
    assertEquals("Number of evaluations", populationSize, results.size());
    for (int index = 0; index < population.size(); index++) {
      DummyCandidate candidate = population.get(index);
      assertEquals("Evaluation of the candidate " + index,
                   DummyEvaluator.getFitness(candidate.getIndex()), results.get(index), EPSILON);
    }
  }
View Full Code Here

Examples of org.apache.mahout.ga.watchmaker.utils.DummyCandidate

    conf.set(EvalMapper.MAHOUT_GA_EVALUATOR, StringUtils.toString(evaluator));
    mapper.configure(conf);

    // evaluate the population using the mapper
    for (int index = 0; index < population.size(); index++) {
      DummyCandidate candidate = population.get(index);
      mapper.map(new LongWritable(index), new Text(StringUtils
          .toString(candidate)), collector, null);
    }

    // check that the evaluations are correct
    Set<String> keys = collector.getKeys();
    assertEquals("Number of evaluations", populationSize, keys.size());
    for (String key : keys) {
      DummyCandidate candidate = population.get(Integer.parseInt(key));
      assertEquals("Values for key " + key, 1, collector.getValue(key).size());
      double fitness = collector.getValue(key).get(0).get();
      assertEquals("Evaluation of the candidate " + key, DummyEvaluator
          .getFitness(candidate.getIndex()), fitness);
    }
  }
View Full Code Here

Examples of org.apache.mahout.ga.watchmaker.utils.DummyCandidate

    MahoutEvaluator.evaluate(evaluator, population, results);

    // check results
    assertEquals("Number of evaluations", populationSize, results.size());
    for (int index = 0; index < population.size(); index++) {
      DummyCandidate candidate = population.get(index);
      assertEquals("Evaluation of the candidate " + index, DummyEvaluator
          .getFitness(candidate.getIndex()), results.get(index));
    }
  }
View Full Code Here

Examples of org.apache.mahout.ga.watchmaker.utils.DummyCandidate

    conf.set(EvalMapper.MAHOUT_GA_EVALUATOR, StringUtils.toString(evaluator));
    mapper.configure(conf);

    // evaluate the population using the mapper
    for (int index = 0; index < population.size(); index++) {
      DummyCandidate candidate = population.get(index);
      mapper.map(new LongWritable(index), new Text(StringUtils
          .toString(candidate)), collector, null);
    }

    // check that the evaluations are correct
    Set<String> keys = collector.getKeys();
    assertEquals("Number of evaluations", populationSize, keys.size());
    for (String key : keys) {
      DummyCandidate candidate = population.get(Integer.parseInt(key));
      assertEquals("Values for key " + key, 1, collector.getValue(key).size());
      double fitness = collector.getValue(key).get(0).get();
      assertEquals("Evaluation of the candidate " + key, DummyEvaluator
          .getFitness(candidate.getIndex()), fitness);
    }
  }
View Full Code Here

Examples of org.apache.mahout.ga.watchmaker.utils.DummyCandidate

    MahoutEvaluator.evaluate(evaluator, population, results);

    // check results
    assertEquals("Number of evaluations", populationSize, results.size());
    for (int index = 0; index < population.size(); index++) {
      DummyCandidate candidate = population.get(index);
      assertEquals("Evaluation of the candidate " + index, DummyEvaluator
          .getFitness(candidate.getIndex()), results.get(index));
    }
  }
View Full Code Here

Examples of org.apache.mahout.ga.watchmaker.utils.DummyCandidate

    MahoutEvaluator.evaluate(evaluator, population, results, input, output);

    // check results
    assertEquals("Number of evaluations", POPULATION_SIZE, results.size());
    for (int index = 0; index < population.size(); index++) {
      DummyCandidate candidate = population.get(index);
      assertEquals("Evaluation of the candidate " + index,
                   DummyEvaluator.getFitness(candidate.getIndex()), results.get(index), EPSILON);
    }
  }
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.