Package org.encog.ensemble.data

Examples of org.encog.ensemble.data.EnsembleDataSet


    super(dataSetSize);
  }

  @Override
  public EnsembleDataSet getNewDataSet() {
    EnsembleDataSet ds = new EnsembleDataSet(dataSource.getInputSize(), dataSource.getIdealSize());
    for (int i = currentPosition; i < currentPosition + dataSource.size() / dataSetSize; i++)
    {
      ds.add(dataSource.get(i % this.dataSource.size()));
    }
    return ds;
  }
View Full Code Here


  }

  @Override
  public EnsembleDataSet getNewDataSet() {
    Random generator = new Random();
    EnsembleDataSet ds = new EnsembleDataSet(dataSource.getInputSize(), dataSource.getIdealSize());
    for (int i = 0; i < dataSetSize; i++)
    {
      int candidate = generator.nextInt(dataSource.size());
      ds.add(dataSource.get(candidate));
    }
    return ds;
  }
View Full Code Here


  public void testBagging() {
    trainingData = XOR.createXORDataSet();
    XOR.testXORDataSet(trainingData);
    trainingData = new EnsembleDataSet(trainingData);
    assertEquals(1,trainingData.getIdealSize());
    assertEquals(2,trainingData.getInputSize());
    EnsembleTrainFactory trainingStrategy = new ResilientPropagationFactory();
    MultiLayerPerceptronFactory mlpFactory = new MultiLayerPerceptronFactory();
    ArrayList<Integer> middleLayers = new ArrayList<Integer>();
View Full Code Here

        current.train(targetError, verbose);
        if (verbose) {System.out.println("test MSE: " + current.getError(testset));};
      } while (current.getError(testset) > selectionError);
    }
    if(aggregator.needsTraining()) {
      EnsembleDataSet aggTrainingSet = new EnsembleDataSet(members.size() * aggregatorDataSet.getIdealSize(),aggregatorDataSet.getIdealSize());
      for (MLDataPair trainingInput:aggregatorDataSet) {
        BasicMLData trainingInstance = new BasicMLData(members.size() * aggregatorDataSet.getIdealSize());
        int index = 0;
        for(EnsembleML member:members){
          for(double val:member.compute(trainingInput.getInput()).getData()) {
            trainingInstance.add(index++, val);
          }
        }
        aggTrainingSet.add(trainingInstance,trainingInput.getIdeal());
      }
      aggregator.setTrainingSet(aggTrainingSet);
      aggregator.train();
    }
  }
View Full Code Here

  public EnsembleDataSet getNewDataSet() {
    double weightSum = 0;
    for (int i = 0; i < dataSource.size(); i++)
      weightSum += dataSource.get(i).getSignificance();
    Random generator = new Random();
    EnsembleDataSet ds = new EnsembleDataSet(dataSource.getInputSize(), dataSource.getIdealSize());
    for (int i = 0; i < dataSetSize; i++)
    {
      double candidate = generator.nextDouble() * weightSum;
      ds.add(getCandidate(candidate));
    }
    return ds;
  }
View Full Code Here

TOP

Related Classes of org.encog.ensemble.data.EnsembleDataSet

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.