Examples of BackPropagationAutoencoder


Examples of com.github.neuralnetworks.training.backpropagation.BackPropagationAutoencoder

  return blc;
    }

    public static BackPropagationAutoencoder backPropagationAutoencoder(NeuralNetworkImpl nn, TrainingInputProvider trainingSet, TrainingInputProvider testingSet, OutputError error, NNRandomInitializer rand, float learningRate, float momentum, float l1weightDecay, float l2weightDecay, float inputCorruptionRate) {
  BackPropagationAutoencoder t = new BackPropagationAutoencoder(backpropProperties(nn, trainingSet, testingSet, error, rand, learningRate, momentum, l1weightDecay, l2weightDecay));

  BackPropagationLayerCalculatorImpl bplc = bplc(nn, t.getProperties());
  t.getProperties().setParameter(Constants.BACKPROPAGATION, bplc);

  return t;
    }
View Full Code Here

Examples of com.github.neuralnetworks.training.backpropagation.BackPropagationAutoencoder

  TrainingInputProvider trainInputProvider = new SimpleInputProvider(new float[][] { { 1, 1, 1, 0, 0, 0 }, { 1, 0, 1, 0, 0, 0 }, { 1, 1, 0, 0, 0, 0 }, { 0, 1, 1, 0, 0, 0 }, { 0, 1, 1, 1, 0, 0 }, { 0, 0, 0, 1, 1, 1 }, { 0, 0, 1, 1, 1, 0 }, { 0, 0, 0, 1, 0, 1 }, { 0, 0, 0, 0, 1, 1 }, { 0, 0, 0, 1, 1, 0 } }, null, 1000, 1);
  TrainingInputProvider testInputProvider = new SimpleInputProvider(new float[][] { { 1, 1, 1, 0, 0, 0 }, { 1, 0, 1, 0, 0, 0 }, { 1, 1, 0, 0, 0, 0 }, { 0, 1, 1, 0, 0, 0 }, { 0, 1, 1, 1, 0, 0 }, { 0, 0, 0, 1, 1, 1 }, { 0, 0, 1, 1, 1, 0 }, { 0, 0, 0, 1, 0, 1 }, { 0, 0, 0, 0, 1, 1 }, { 0, 0, 0, 1, 1, 0 } }, new float[][] { { 1, 0 }, { 1, 0 }, { 1, 0 }, { 1, 0 }, { 1, 0 }, { 0, 1 }, { 0, 1 }, { 0, 1 }, { 0, 1 }, { 0, 1 } }, 10, 1);
  MultipleNeuronsOutputError error = new MultipleNeuronsOutputError();

  // backpropagation for autoencoders
  BackPropagationAutoencoder t = TrainerFactory.backPropagationAutoencoder(ae, trainInputProvider, testInputProvider, error, new NNRandomInitializer(new MersenneTwisterRandomInitializer(-0.01f, 0.01f)), 0.1f, 0.5f, 0f, 0f, 0f);

  // log data
  t.addEventListener(new LogTrainingListener(Thread.currentThread().getStackTrace()[1].getMethodName(), true, false));

  // sequential execution for debugging
  Environment.getInstance().setExecutionMode(EXECUTION_MODE.SEQ);

  // training
  t.train();

  // the output layer is removed, thus making the hidden layer the new output
  ae.removeLayer(ae.getOutputLayer());

  // testing
  t.test();

  assertEquals(0, t.getOutputError().getTotalNetworkError(), 0);
    }
View Full Code Here

Examples of com.github.neuralnetworks.training.backpropagation.BackPropagationAutoencoder

      TrainingInputProvider trainInputProvider = new IrisInputProvider(1, 15000, new IrisTargetMultiNeuronOutputConverter(), false, true, false);
      TrainingInputProvider testInputProvider = new IrisInputProvider(1, 150, new IrisTargetMultiNeuronOutputConverter(), false, true, false);
      MultipleNeuronsOutputError error = new MultipleNeuronsOutputError();

      // backpropagation autoencoder training
      BackPropagationAutoencoder bae = TrainerFactory.backPropagationAutoencoder(ae, trainInputProvider, testInputProvider, error, new NNRandomInitializer(new MersenneTwisterRandomInitializer(-0.01f, 0.01f)), 0.25f, 0.5f, 0f, 0f, 0f);

      // log data to console
      bae.addEventListener(new LogTrainingListener(Thread.currentThread().getStackTrace()[1].getMethodName()));

      // execution mode
      Environment.getInstance().setExecutionMode(EXECUTION_MODE.SEQ);

      bae.train();

      // the output layer is needed only during the training phase...
      ae.removeLayer(ae.getOutputLayer());

      bae.test();

      // 2 of the iris classes are linearly not separable - an error of 1/3 illustrates that
      assertEquals(0, bae.getOutputError().getTotalNetworkError(), 1/3f);
    }
View Full Code Here

Examples of com.github.neuralnetworks.training.backpropagation.BackPropagationAutoencoder

  Autoencoder lastNN = sae.getLastNeuralNetwork();
  lastNN.setLayerCalculator(NNFactory.lcSigmoid(lastNN, null));

  // trainers for each of the stacked networks
  BackPropagationAutoencoder firstTrainer = TrainerFactory.backPropagationAutoencoder(firstNN, null, null, null, new NNRandomInitializer(new MersenneTwisterRandomInitializer(-0.01f, 0.01f)), 0.001f, 0.5f, 0f, 0f, 0f);
  BackPropagationAutoencoder secondTrainer = TrainerFactory.backPropagationAutoencoder(lastNN, null, null, null, new NNRandomInitializer(new MersenneTwisterRandomInitializer(-0.01f, 0.01f)), 0.001f, 0.5f, 0f, 0f, 0f);

  Map<NeuralNetwork, OneStepTrainer<?>> map = new HashMap<>();
  map.put(firstNN, firstTrainer);
  map.put(lastNN, secondTrainer);
View Full Code Here

Examples of com.github.neuralnetworks.training.backpropagation.BackPropagationAutoencoder

  testInputProvider.addInputModifier(new ScalingInputFunction(testInputProvider));

      MultipleNeuronsOutputError error = new MultipleNeuronsOutputError();

      // backpropagation autoencoder training
      BackPropagationAutoencoder bae = TrainerFactory.backPropagationAutoencoder(ae, trainInputProvider, testInputProvider, error, new NNRandomInitializer(new MersenneTwisterRandomInitializer(-0.01f, 0.01f)), 0.02f, 0.7f, 0f, 0f, 0f, 1, 1, 100);

      // log data to console
      bae.addEventListener(new LogTrainingListener(Thread.currentThread().getStackTrace()[1].getMethodName()));

      bae.train();

      // the output layer is needed only during the training phase...
      ae.removeLayer(ae.getOutputLayer());

      bae.test();

      // 2 of the iris classes are linearly not separable - an error of 1/3 illustrates that
      assertEquals(0, bae.getOutputError().getTotalNetworkError(), 2/3f);
    }
View Full Code Here

Examples of com.github.neuralnetworks.training.backpropagation.BackPropagationAutoencoder

  Autoencoder lastNN = sae.getLastNeuralNetwork();
  lastNN.setLayerCalculator(NNFactory.lcSigmoid(lastNN, null));

  // trainers for each of the stacked networks
  BackPropagationAutoencoder firstTrainer = TrainerFactory.backPropagationAutoencoder(firstNN, null, null, null, new NNRandomInitializer(new MersenneTwisterRandomInitializer(-0.01f, 0.01f), 0.5f), 0.02f, 0.7f, 0f, 0f, 0f, 150, 1, 2000);
  BackPropagationAutoencoder secondTrainer = TrainerFactory.backPropagationAutoencoder(lastNN, null, null, null, new NNRandomInitializer(new MersenneTwisterRandomInitializer(-0.01f, 0.01f), 0.5f), 0.02f, 0.7f, 0f, 0f, 0f, 150, 1, 2000);

  Map<NeuralNetwork, OneStepTrainer<?>> map = new HashMap<>();
  map.put(firstNN, firstTrainer);
  map.put(lastNN, secondTrainer);
View Full Code Here

Examples of com.github.neuralnetworks.training.backpropagation.BackPropagationAutoencoder

  TrainingInputProvider trainInputProvider = new SimpleInputProvider(new float[][] { { 1, 1, 1, 0, 0, 0 }, { 1, 0, 1, 0, 0, 0 }, { 1, 1, 0, 0, 0, 0 }, { 0, 1, 1, 0, 0, 0 }, { 0, 1, 1, 1, 0, 0 }, { 0, 0, 0, 1, 1, 1 }, { 0, 0, 1, 1, 1, 0 }, { 0, 0, 0, 1, 0, 1 }, { 0, 0, 0, 0, 1, 1 }, { 0, 0, 0, 1, 1, 0 } }, null);
  TrainingInputProvider testInputProvider = new SimpleInputProvider(new float[][] { { 1, 1, 1, 0, 0, 0 }, { 1, 0, 1, 0, 0, 0 }, { 1, 1, 0, 0, 0, 0 }, { 0, 1, 1, 0, 0, 0 }, { 0, 1, 1, 1, 0, 0 }, { 0, 0, 0, 1, 1, 1 }, { 0, 0, 1, 1, 1, 0 }, { 0, 0, 0, 1, 0, 1 }, { 0, 0, 0, 0, 1, 1 }, { 0, 0, 0, 1, 1, 0 } }, new float[][] { { 1, 0 }, { 1, 0 }, { 1, 0 }, { 1, 0 }, { 1, 0 }, { 0, 1 }, { 0, 1 }, { 0, 1 }, { 0, 1 }, { 0, 1 } });
  MultipleNeuronsOutputError error = new MultipleNeuronsOutputError();

  // backpropagation for autoencoders
  BackPropagationAutoencoder t = TrainerFactory.backPropagationAutoencoder(ae, trainInputProvider, testInputProvider, error, new NNRandomInitializer(new MersenneTwisterRandomInitializer(-0.01f, 0.01f)), 0.02f, 0.7f, 0f, 0f, 0f, 1, 1, 100);

  // log data
  t.addEventListener(new LogTrainingListener(Thread.currentThread().getStackTrace()[1].getMethodName(), true, false));

  // early stopping
  //t.addEventListener(new EarlyStoppingListener(t.getTrainingInputProvider(), 1000, 0.1f));

  // training
  t.train();

  // the output layer is removed, thus making the hidden layer the new output
  ae.removeLayer(ae.getOutputLayer());

  // testing
  t.test();

  assertEquals(0, t.getOutputError().getTotalNetworkError(), 0);
    }
View Full Code Here

Examples of com.github.neuralnetworks.training.backpropagation.BackPropagationAutoencoder

    public static BackPropagationAutoencoder backPropagationAutoencoder(NeuralNetworkImpl nn, TrainingInputProvider trainingSet, TrainingInputProvider testingSet, OutputError error, NNRandomInitializer rand, float learningRate, float momentum, float l1weightDecay, float l2weightDecay, float inputCorruptionRate, int trainingBatchSize, int testBatchSize, int epochs) {
  Properties p = backpropProperties(nn, trainingSet, testingSet, error, rand, learningRate, momentum, l1weightDecay, l2weightDecay, 0F, trainingBatchSize, testBatchSize, epochs);
  p.setParameter(Constants.CORRUPTION_LEVEL, inputCorruptionRate);
  p.setParameter(Constants.BACKPROPAGATION, bplc(nn, p));

  return new BackPropagationAutoencoder(p);
    }
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.