Package org.encog.ml.data.basic

Examples of org.encog.ml.data.basic.BasicMLDataSet


  public static double XOR_IDEAL[][] = { { 0.0 }, { 1.0 }, { 1.0 }, { 0.0 } };

  public static void main(final String args[]) {

    MLDataSet trainingSet = new BasicMLDataSet(XOR_INPUT, XOR_IDEAL);
    NEATPopulation pop = new NEATPopulation(2,1,1000);
    CalculateScore score = new TrainingSetScore(trainingSet);
    // train the neural network
    ActivationStep step = new ActivationStep();
    step.setCenter(0.5);
View Full Code Here


    try {
      final int inputNeuron = OCR.DOWNSAMPLE_HEIGHT
          * OCR.DOWNSAMPLE_WIDTH;
      final int outputNeuron = this.letterListModel.size();

      final MLDataSet trainingSet = new BasicMLDataSet();
      for (int t = 0; t < this.letterListModel.size(); t++) {
        final MLData item = new BasicMLData(inputNeuron);
        int idx = 0;
        final SampleData ds = (SampleData) this.letterListModel
            .getElementAt(t);
        for (int y = 0; y < ds.getHeight(); y++) {
          for (int x = 0; x < ds.getWidth(); x++) {
            item.setData(idx++, ds.getData(x, y) ? .5 : -.5);
          }
        }

        trainingSet.add(new BasicMLDataPair(item, null));
      }

      this.net = new SOM(inputNeuron,outputNeuron);
      this.net.reset();

View Full Code Here

    network.addLayer(new BasicLayer(2));
    network.addLayer(new BasicLayer(1));
    network.getStructure().finalizeStructure();
    network.reset();

    MLDataSet trainingSet = new BasicMLDataSet(XOR_INPUT, XOR_IDEAL);

    // train the neural network
    final MLTrain train = new ResilientPropagation(network, trainingSet);

    do {
View Full Code Here

import org.encog.util.benchmark.RandomTrainingFactory;

public class BinaryVsMemory {
  private static int evalMemory()
  {
    final BasicMLDataSet training = RandomTrainingFactory.generate(1000,
        10000, 10, 10, -1, 1);
   
    final long start = System.currentTimeMillis();
    final long stop = start + (10*Evaluate.MILIS);
    int record = 0;
   
    MLDataPair pair = BasicMLDataPair.createPair(10, 10);
   
    int iterations = 0;
    while( System.currentTimeMillis()<stop ) {
      iterations++;
      training.getRecord(record++, pair)
      if( record>=training.getRecordCount() )
        record = 0;
    }
   
    System.out.println("In 10 seconds, the memory dataset read " +
        Format.formatInteger( iterations) + " records.");
View Full Code Here

  public void loadAndEvaluate() {
    System.out.println("Loading network");

    BasicNetwork network = (BasicNetwork)EncogDirectoryPersistence.loadObject(new File(FILENAME));

    MLDataSet trainingSet = new BasicMLDataSet(XOR_INPUT, XOR_IDEAL);
    double e = network.calculateError(trainingSet);
    System.out
        .println("Loaded network's error is(should be same as above): "
            + e);
  }
View Full Code Here

 
  private static int evalBinary()
  {
    File file = new File("temp.egb");
   
    final BasicMLDataSet training = RandomTrainingFactory.generate(1000,
        10000, 10, 10, -1, 1);
   
    // create the binary file
   
    file.delete();
View Full Code Here

  public static long benchmarkEncogFlat(double[][] input, double[][] output) {
    FlatNetwork network = new FlatNetwork(input[0].length, HIDDEN_COUNT, 0,
        output[0].length, false);
    network.randomize();
    BasicMLDataSet trainingSet = new BasicMLDataSet(input, output);

    TrainFlatNetworkBackPropagation train = new TrainFlatNetworkBackPropagation(
        network, trainingSet, 0.7, 0.7);

    double[] a = new double[2];
View Full Code Here

    network.addLayer(new BasicLayer(2));
    network.addLayer(new BasicLayer(1));
    network.getStructure().finalizeStructure();
    network.reset();

    MLDataSet trainingSet = new BasicMLDataSet(XOR_INPUT, XOR_IDEAL);

    // train the neural network
    final MLTrain train = new ResilientPropagation(network, trainingSet);

    do {
View Full Code Here

  }

  public void loadAndEvaluate() throws IOException, ClassNotFoundException {
    System.out.println("Loading network");
    BasicNetwork network = (BasicNetwork) SerializeObject.load(new File(FILENAME));
    MLDataSet trainingSet = new BasicMLDataSet(XOR_INPUT, XOR_IDEAL);
    double e = network.calculateError(trainingSet);
    System.out
        .println("Loaded network's error is(should be same as above): "
            + e);
  }
View Full Code Here

   */
  @Override
  public final void iteration() {

    if (!this.samplesLoaded) {
      this.network.setSamples(new BasicMLDataSet(this.training));
      this.samplesLoaded = true;
    }

    final GlobalMinimumSearch globalMinimum = new GlobalMinimumSearch();
    final DeriveMinimum dermin = new DeriveMinimum();
View Full Code Here

TOP

Related Classes of org.encog.ml.data.basic.BasicMLDataSet

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.