Examples of RBMLayerCalculator


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, boolean isPersistentCD) {
  rbm.setLayerCalculator(NNFactory.rbmSoftReluSoftRelu(rbm));

  RBMLayerCalculator lc = NNFactory.rbmSigmoidSigmoid(rbm);
  ConnectionCalculatorFullyConnected cc = (ConnectionCalculatorFullyConnected) lc.getConnectionCalculator(rbm.getInputLayer());
  cc.addPreTransferFunction(new BernoulliDistribution());

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

Examples of com.github.neuralnetworks.calculation.RBMLayerCalculator

    }

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

  RBMLayerCalculator lc = NNFactory.rbmSigmoidSigmoid(rbm);
  ConnectionCalculatorFullyConnected cc = (ConnectionCalculatorFullyConnected) lc.getConnectionCalculator(rbm.getInputLayer());
  cc.addPreTransferFunction(new BernoulliDistribution());

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

Examples of com.github.neuralnetworks.calculation.RBMLayerCalculator

  cg1.set(0.1f, 0, 0);
  cg1.set(0.8f, 0, 1);
  cg1.set(0.4f, 1, 0);
  cg1.set(0.6f, 1, 1);

  RBMLayerCalculator lc = (RBMLayerCalculator) rbm.getLayerCalculator();

  Matrix visible = new Matrix(new float[] { 0.35f, 0.9f }, 1);
  Matrix hidden = new Matrix(2, 1);
  lc.calculateHiddenLayer(rbm, visible, hidden);

  assertEquals(0.68, hidden.get(0, 0), 0.01);
  assertEquals(0.6637, hidden.get(1, 0), 0.01);
    }
View Full Code Here

Examples of com.github.neuralnetworks.calculation.RBMLayerCalculator

  cg1.set(0.1f, 0, 0);
  cg1.set(0.8f, 1, 0);
  cg1.set(0.4f, 0, 1);
  cg1.set(0.6f, 1, 1);

  RBMLayerCalculator lc = (RBMLayerCalculator) rbm.getLayerCalculator();

  Matrix visible = new Matrix(2, 1);
  Matrix hidden = new Matrix(new float[] { 0.35f, 0.9f }, 1);

  lc.calculateVisibleLayer(rbm, visible, hidden);

  assertEquals(0.68, visible.get(0, 0), 0.01);
  assertEquals(0.6637, visible.get(1, 0), 0.01);
    }
View Full Code Here

Examples of com.github.neuralnetworks.calculation.RBMLayerCalculator

  Matrix cgb1 = rbm.getHiddenBiasConnections().getConnectionGraph();
  cgb1.set(-0.4f, 0, 0);
  cgb1.set(0.2f, 1, 0);

  RBMLayerCalculator lc = (RBMLayerCalculator) rbm.getLayerCalculator();
  Matrix visible = new Matrix(new float[] { 1f, 0f, 1f }, 1);
  Matrix hidden = new Matrix(2, 1);
  lc.calculateHiddenLayer(rbm, visible, hidden);

  assertEquals(0.332, hidden.get(0, 0), 0.001);
  assertEquals(0.525, hidden.get(1, 0), 0.001);
    }
View Full Code Here

Examples of com.github.neuralnetworks.calculation.RBMLayerCalculator

  Matrix cgb1 = rbm.getVisibleBiasConnections().getConnectionGraph();
  cgb1.set(-0.4f, 0, 0);
  cgb1.set(0.2f, 1, 0);

  RBMLayerCalculator lc = (RBMLayerCalculator) rbm.getLayerCalculator();
  Matrix hidden = new Matrix(new float[] { 1f, 0f, 1f }, 1);
  Matrix visible = new Matrix(2, 1);
  lc.calculateVisibleLayer(rbm, visible, hidden);

  assertEquals(0.332, visible.get(0, 0), 0.001);
  assertEquals(0.525, visible.get(1, 0), 0.001);
    }
View Full Code Here

Examples of com.github.neuralnetworks.calculation.RBMLayerCalculator

    public static RBM rbm(int visibleCount, int hiddenCount, boolean addBias) {
  return new RBM(visibleCount, hiddenCount, addBias, addBias);
    }
   
    public static RBMLayerCalculator rbmWeightedSumWeightedSum(RBM rbm) {
  RBMLayerCalculator lc = new RBMLayerCalculator();
  lc.addConnectionCalculator(rbm.getVisibleLayer(), new AparapiWeightedSumConnectionCalculator());
  lc.addConnectionCalculator(rbm.getHiddenLayer(), new AparapiWeightedSumConnectionCalculator());
  populateBiasLayers(lc, rbm);
  return lc;
    }
View Full Code Here

Examples of com.github.neuralnetworks.calculation.RBMLayerCalculator

  populateBiasLayers(lc, rbm);
  return lc;
    }

    public static RBMLayerCalculator rbmSigmoidSigmoid(RBM rbm) {
  RBMLayerCalculator lc = new RBMLayerCalculator();
  lc.addConnectionCalculator(rbm.getVisibleLayer(), new AparapiSigmoid());
  lc.addConnectionCalculator(rbm.getHiddenLayer(), new AparapiSigmoid());
  populateBiasLayers(lc, rbm);
  return lc;
    }
View Full Code Here

Examples of com.github.neuralnetworks.calculation.RBMLayerCalculator

  populateBiasLayers(lc, rbm);
  return lc;
    }

    public static RBMLayerCalculator rbmSoftReluSoftRelu(RBM rbm) {
  RBMLayerCalculator lc = new RBMLayerCalculator();

  AparapiSoftReLU c1 = new AparapiSoftReLU();
  c1.addActivationFunction(new SoftmaxFunction());
  lc.addConnectionCalculator(rbm.getVisibleLayer(), c1);


  AparapiSoftReLU c2 = new AparapiSoftReLU();
  c2.addActivationFunction(new SoftmaxFunction());
  lc.addConnectionCalculator(rbm.getHiddenLayer(), c2);

  populateBiasLayers(lc, rbm);

  return lc;
    }
View Full Code Here

Examples of com.github.neuralnetworks.calculation.RBMLayerCalculator

  return lc;
    }
   
    public static RBMLayerCalculator rbmReluRelu(RBM rbm) {
  RBMLayerCalculator lc = new RBMLayerCalculator();

  AparapiReLU c1 = new AparapiReLU();
  c1.addActivationFunction(new SoftmaxFunction());
  lc.addConnectionCalculator(rbm.getVisibleLayer(), c1);

  AparapiReLU c2 = new AparapiReLU();
  c2.addActivationFunction(new SoftmaxFunction());
  lc.addConnectionCalculator(rbm.getHiddenLayer(), c2);

  populateBiasLayers(lc, rbm);

  return lc;
    }
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.