Package org.apache.mahout.ga.watchmaker.cd.hadoop

Examples of org.apache.mahout.ga.watchmaker.cd.hadoop.DatasetSplit$RndLineRecordReader


    operators.add(new CDCrossover(crosspnts));
    operators.add(new CDMutation(mutrate, mutrange, mutprec));
    EvolutionPipeline<CDRule> pipeline = new EvolutionPipeline<CDRule>(operators);
   
    // 75 % of the dataset is dedicated to training
    DatasetSplit split = new DatasetSplit(0.75);
   
    // Fitness Evaluator (defaults to training)
    FitnessEvaluator<? super CDRule> evaluator = new CDFitnessEvaluator(dataset, target, split);
    // Selection Strategy
    SelectionStrategy<? super CDRule> selection = new RouletteWheelSelection();
   
    EvolutionEngine<CDRule> engine = new SequentialEvolutionEngine<CDRule>(factory, pipeline, evaluator,
        selection, RandomUtils.getRandom());
   
    engine.addEvolutionObserver(new EvolutionObserver<CDRule>() {
      @Override
      public void populationUpdate(PopulationData<? extends CDRule> data) {
        log.info("Generation {}", data.getGenerationNumber());
      }
    });
   
    // evolve the rules over the training set
    Rule solution = engine.evolve(popSize, 1, new GenerationCount(genCount));
   
    // fitness over the training set
    CDFitness bestTrainFit = CDMahoutEvaluator.evaluate(solution, target, inpath, split);
   
    // fitness over the testing set
    split.setTraining(false);
    CDFitness bestTestFit = CDMahoutEvaluator.evaluate(solution, target, inpath, split);
   
    // evaluate the solution over the testing set
    log.info("Best solution fitness (train set) : {}", bestTrainFit);
    log.info("Best solution fitness (test set) : {}", bestTestFit);
View Full Code Here


    operators.add(new CDCrossover(crosspnts));
    operators.add(new CDMutation(mutrate, mutrange, mutprec));
    EvolutionPipeline<CDRule> pipeline = new EvolutionPipeline<CDRule>(operators);

    // 75 % of the dataset is dedicated to training
    DatasetSplit split = new DatasetSplit(0.75);

    // Fitness Evaluator (defaults to training)
    FitnessEvaluator<? super CDRule> evaluator = new CDFitnessEvaluator(dataset, target, split);
    // Selection Strategy
    SelectionStrategy<? super CDRule> selection = new RouletteWheelSelection();

    EvolutionEngine<CDRule> engine =
        new SequentialEvolutionEngine<CDRule>(factory, pipeline, evaluator, selection, RandomUtils.getRandom());

    engine.addEvolutionObserver(new EvolutionObserver<CDRule>() {
      @Override
      public void populationUpdate(PopulationData<? extends CDRule> data) {
        log.info("Generation {}", data.getGenerationNumber());
      }
    });

    // evolve the rules over the training set
    Rule solution = engine.evolve(popSize, 1, new GenerationCount(genCount));

    Path output = new Path("output");

    // fitness over the training set
    CDFitness bestTrainFit = CDMahoutEvaluator.evaluate(solution, target, inpath, output, split);

    // fitness over the testing set
    split.setTraining(false);
    CDFitness bestTestFit = CDMahoutEvaluator.evaluate(solution, target, inpath, output, split);

    // evaluate the solution over the testing set
    log.info("Best solution fitness (train set) : {}", bestTrainFit);
    log.info("Best solution fitness (test set) : {}", bestTestFit);
View Full Code Here

    operators.add(new CDCrossover(crosspnts));
    operators.add(new CDMutation(mutrate, mutrange, mutprec));
    EvolutionPipeline<CDRule> pipeline = new EvolutionPipeline<CDRule>(operators);

    // 75 % of the dataset is dedicated to training
    DatasetSplit split = new DatasetSplit(0.75);

    // Fitness Evaluator (defaults to training)
    FitnessEvaluator<? super CDRule> evaluator = new CDFitnessEvaluator(dataset, target, split);
    // Selection Strategy
    SelectionStrategy<? super CDRule> selection = new RouletteWheelSelection();

    EvolutionEngine<CDRule> engine =
        new SequentialEvolutionEngine<CDRule>(factory, pipeline, evaluator, selection, RandomUtils.getRandom());

    engine.addEvolutionObserver(new EvolutionObserver<CDRule>() {
      @Override
      public void populationUpdate(PopulationData<? extends CDRule> data) {
        log.info("Generation {}", data.getGenerationNumber());
      }
    });

    // evolve the rules over the training set
    Rule solution = engine.evolve(popSize, 1, new GenerationCount(genCount));

    Path output = new Path("output");

    // fitness over the training set
    CDFitness bestTrainFit = CDMahoutEvaluator.evaluate(solution, target, inpath, output, split);

    // fitness over the testing set
    split.setTraining(false);
    CDFitness bestTestFit = CDMahoutEvaluator.evaluate(solution, target, inpath, output, split);

    // evaluate the solution over the testing set
    log.info("Best solution fitness (train set) : {}", bestTrainFit);
    log.info("Best solution fitness (test set) : {}", bestTestFit);
View Full Code Here

    operators.add(new CDCrossover(crosspnts));
    operators.add(new CDMutation(mutrate, mutrange, mutprec));
    EvolutionPipeline<CDRule> pipeline = new EvolutionPipeline<CDRule>(operators);

    // 75 % of the dataset is dedicated to training
    DatasetSplit split = new DatasetSplit(0.75);

    // Fitness Evaluator (defaults to training)
    FitnessEvaluator<? super CDRule> evaluator = new CDFitnessEvaluator(
        dataset, target, split);
    // Selection Strategy
    SelectionStrategy<? super CDRule> selection = new RouletteWheelSelection();

    EvolutionEngine<CDRule> engine = new SequentialEvolutionEngine<CDRule>(factory,
        pipeline, evaluator, selection, new MersenneTwisterRNG());

    engine.addEvolutionObserver(new EvolutionObserver<CDRule>() {
      @Override
      public void populationUpdate(PopulationData<? extends CDRule> data) {
        log.info("Generation {}", data.getGenerationNumber());
      }
    });

    // evolve the rules over the training set
    Rule solution = engine.evolve(popSize, 1, new GenerationCount(genCount));

    // fitness over the training set
    CDFitness bestTrainFit = CDMahoutEvaluator.evaluate(solution, target,
        inpath, split);

    // fitness over the testing set
    split.setTraining(false);
    CDFitness bestTestFit = CDMahoutEvaluator.evaluate(solution, target,
        inpath, split);

    // evaluate the solution over the testing set
    log.info("Best solution fitness (train set) : {}", bestTrainFit);
View Full Code Here

    operators.add(new CDCrossover(crosspnts));
    operators.add(new CDMutation(mutrate, mutrange, mutprec));
    EvolutionPipeline<CDRule> pipeline = new EvolutionPipeline<CDRule>(operators);

    // 75 % of the dataset is dedicated to training
    DatasetSplit split = new DatasetSplit(0.75);

    // Fitness Evaluator (defaults to training)
    FitnessEvaluator<? super CDRule> evaluator = new CDFitnessEvaluator(
        dataset, target, split);
    // Selection Strategy
    SelectionStrategy<? super CDRule> selection = new RouletteWheelSelection();

    EvolutionEngine<CDRule> engine = new SequentialEvolutionEngine<CDRule>(factory,
        pipeline, evaluator, selection, RandomUtils.getRandom());

    engine.addEvolutionObserver(new EvolutionObserver<CDRule>() {
      @Override
      public void populationUpdate(PopulationData<? extends CDRule> data) {
        log.info("Generation {}", data.getGenerationNumber());
      }
    });

    // evolve the rules over the training set
    Rule solution = engine.evolve(popSize, 1, new GenerationCount(genCount));

    // fitness over the training set
    CDFitness bestTrainFit = CDMahoutEvaluator.evaluate(solution, target,
        inpath, split);

    // fitness over the testing set
    split.setTraining(false);
    CDFitness bestTestFit = CDMahoutEvaluator.evaluate(solution, target,
        inpath, split);

    // evaluate the solution over the testing set
    log.info("Best solution fitness (train set) : {}", bestTrainFit);
View Full Code Here

TOP

Related Classes of org.apache.mahout.ga.watchmaker.cd.hadoop.DatasetSplit$RndLineRecordReader

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.