Examples of RBMLayerCalculator


Examples of com.github.neuralnetworks.calculation.RBMLayerCalculator

  return lc;
    }

    public static RBMLayerCalculator rbmTanhTanh(RBM rbm) {
  RBMLayerCalculator lc = new RBMLayerCalculator();
  lc.addConnectionCalculator(rbm.getVisibleLayer(), new AparapiTanh());
  lc.addConnectionCalculator(rbm.getHiddenLayer(), new AparapiTanh());
  populateBiasLayers(lc, rbm);

  return lc;
    }
View Full Code Here

Examples of com.github.neuralnetworks.calculation.RBMLayerCalculator

    }

    public static AparapiCDTrainer cdSoftReLUTrainer(RBM rbm, TrainingInputProvider trainingSet, TrainingInputProvider testingSet, OutputError error, NNRandomInitializer rand, float learningRate, float momentum, float l1weightDecay, float l2weightDecay, int gibbsSampling, int trainingBatchSize, int epochs, boolean isPersistentCD) {
  rbm.setLayerCalculator(NNFactory.lcSoftRelu(rbm, null));

  RBMLayerCalculator lc = NNFactory.rbmSoftReluSoftRelu(rbm, trainingBatchSize);
  ConnectionCalculatorFullyConnected cc = (ConnectionCalculatorFullyConnected) lc.getNegPhaseHiddenToVisibleCC();
  cc.addPreTransferFunction(new BernoulliDistribution());

  return new AparapiCDTrainer(rbmProperties(rbm, lc, trainingSet, testingSet, error, rand, learningRate, momentum, l1weightDecay, l2weightDecay, gibbsSampling, trainingBatchSize, epochs, isPersistentCD));
    }
View Full Code Here

Examples of com.github.neuralnetworks.calculation.RBMLayerCalculator

    }

    public static AparapiCDTrainer cdSigmoidBinaryTrainer(RBM rbm, TrainingInputProvider trainingSet, TrainingInputProvider testingSet, OutputError error, NNRandomInitializer rand, float learningRate, float momentum, float l1weightDecay, float l2weightDecay, int gibbsSampling, int trainingBatchSize, int epochs, boolean isPersistentCD) {
  rbm.setLayerCalculator(NNFactory.lcSigmoid(rbm, null));

  RBMLayerCalculator lc = NNFactory.rbmSigmoidSigmoid(rbm, trainingBatchSize);
  ConnectionCalculatorFullyConnected cc = (ConnectionCalculatorFullyConnected) lc.getNegPhaseHiddenToVisibleCC();
  cc.addPreTransferFunction(new BernoulliDistribution());

  return new AparapiCDTrainer(rbmProperties(rbm, lc, trainingSet, testingSet, error, rand, learningRate, momentum, l1weightDecay, l2weightDecay, gibbsSampling, trainingBatchSize, epochs, isPersistentCD));
    }
View Full Code Here

Examples of com.github.neuralnetworks.calculation.RBMLayerCalculator

  return new AparapiCDTrainer(rbmProperties(rbm, lc, trainingSet, testingSet, error, rand, learningRate, momentum, l1weightDecay, l2weightDecay, gibbsSampling, trainingBatchSize, epochs, isPersistentCD));
    }
   
    public static AparapiCDTrainer cdSigmoidTrainer(RBM rbm, TrainingInputProvider trainingSet, TrainingInputProvider testingSet, OutputError error, NNRandomInitializer rand, float learningRate, float momentum, float l1weightDecay, float l2weightDecay, int gibbsSampling, int trainingBatchSize, int epochs, boolean isPersistentCD) {
  rbm.setLayerCalculator(NNFactory.lcSigmoid(rbm, null));
  RBMLayerCalculator lc = NNFactory.rbmSigmoidSigmoid(rbm, trainingBatchSize);
  return new AparapiCDTrainer(rbmProperties(rbm, lc, trainingSet, testingSet, error, rand, learningRate, momentum, l1weightDecay, l2weightDecay, gibbsSampling, trainingBatchSize, epochs, isPersistentCD));
    }
View Full Code Here

Examples of com.github.neuralnetworks.calculation.RBMLayerCalculator

     */
    @Override
    protected void updateWeights() {
  RBM rbm = getNeuralNetwork();

  RBMLayerCalculator lc = getLayerCalculator();
  int mbs = lc.getPositivePhaseVisible().getDimensions()[lc.getPositivePhaseVisible().getDimensions().length - 1];

  if (weightUpdatesKernel == null || weightUpdatesKernel.getMiniBatchSize() != mbs) {
      weightUpdatesKernel = new CDWeightUpdatesKernel(lc.getPositivePhaseVisible(), lc.getPositivePhaseHidden(), lc.getNegativePhaseVisible(), lc.getNegativePhaseHidden(), rbm.getMainConnections().getWeights(), getLearningRate(), getMomentum(), getl1weightDecay(), getl2weightDecay());
  }
  Environment.getInstance().getExecutionStrategy().execute(weightUpdatesKernel, rbm.getMainConnections().getWeights().getRows());

  // update visible bias
  if (rbm.getVisibleBiasConnections() != null) {
      if (visibleBiasUpdatesKernel == null || visibleBiasUpdatesKernel.getMiniBatchSize() != mbs) {
    visibleBiasUpdatesKernel = new CDBiasUpdatesKernel(rbm.getVisibleBiasConnections().getWeights(), lc.getPositivePhaseVisible(), lc.getNegativePhaseVisible(), getLearningRate(), getMomentum());
      }

      Environment.getInstance().getExecutionStrategy().execute(visibleBiasUpdatesKernel, rbm.getVisibleBiasConnections().getWeights().getSize());
  }

  // update hidden bias
  if (rbm.getHiddenBiasConnections() != null) {
      if (hiddenBiasUpdatesKernel == null || hiddenBiasUpdatesKernel.getMiniBatchSize() != mbs) {
    hiddenBiasUpdatesKernel = new CDBiasUpdatesKernel(rbm.getHiddenBiasConnections().getWeights(), lc.getPositivePhaseHidden(), lc.getNegativePhaseHidden(), getLearningRate(), getMomentum());
      }

      Environment.getInstance().getExecutionStrategy().execute(hiddenBiasUpdatesKernel, rbm.getHiddenBiasConnections().getWeights().getSize());
  }
    }
View Full Code Here

Examples of com.github.neuralnetworks.calculation.RBMLayerCalculator

  return result;
    }

    public static RBMLayerCalculator rbmWeightedSumWeightedSum(RBM rbm, int batchSize) {
  return new RBMLayerCalculator(rbm, batchSize, new AparapiWeightedSumConnectionCalculator(), new AparapiWeightedSumConnectionCalculator(), new AparapiWeightedSumConnectionCalculator());
    }
View Full Code Here

Examples of com.github.neuralnetworks.calculation.RBMLayerCalculator

    public static RBMLayerCalculator rbmWeightedSumWeightedSum(RBM rbm, int batchSize) {
  return new RBMLayerCalculator(rbm, batchSize, new AparapiWeightedSumConnectionCalculator(), new AparapiWeightedSumConnectionCalculator(), new AparapiWeightedSumConnectionCalculator());
    }

    public static RBMLayerCalculator rbmSigmoidSigmoid(RBM rbm, int batchSize) {
  return new RBMLayerCalculator(rbm, batchSize, new AparapiSigmoid(), new AparapiSigmoid(), new AparapiSigmoid());
    }
View Full Code Here

Examples of com.github.neuralnetworks.calculation.RBMLayerCalculator

  AparapiSoftReLU c2 = new AparapiSoftReLU();

  AparapiSoftReLU c3 = new AparapiSoftReLU();

  return new RBMLayerCalculator(rbm, batchSize, c1, c2, c3);
    }
View Full Code Here

Examples of com.github.neuralnetworks.calculation.RBMLayerCalculator

  AparapiReLU c2 = new AparapiReLU();

  AparapiReLU c3 = new AparapiReLU();

  return new RBMLayerCalculator(rbm, batchSize, c1, c2, c3);
    }
View Full Code Here

Examples of com.github.neuralnetworks.calculation.RBMLayerCalculator

  return new RBMLayerCalculator(rbm, batchSize, c1, c2, c3);
    }

    public static RBMLayerCalculator rbmTanhTanh(RBM rbm, int batchSize) {
  return new RBMLayerCalculator(rbm, batchSize, new AparapiTanh(), new AparapiTanh(), new AparapiTanh());
    }
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.