Package com.github.neuralnetworks.training.random

Examples of com.github.neuralnetworks.training.random.NNRandomInitializer.initialize()


    @Test
    public void testRandomInitializer() {
  NeuralNetworkImpl nn = NNFactory.mlp(new int[] { 3, 2 }, true);
  NNRandomInitializer rand = new NNRandomInitializer(new MersenneTwisterRandomInitializer(-0.1f, 0.1f), 0.5f);
  rand.initialize(nn);

  for (Layer l : nn.getLayers()) {
      if (Util.isBias(l)) {
    GraphConnections gc = (GraphConnections) l.getConnections().get(0);
    for (float v : gc.getConnectionGraph().getElements()) {
View Full Code Here


    }
      }
  }

  rand = new NNRandomInitializer(new MersenneTwisterRandomInitializer(2f, 3f), new MersenneTwisterRandomInitializer(-2f, -1f));
  rand.initialize(nn);

  for (Layer l : nn.getLayers()) {
      if (Util.isBias(l)) {
    GraphConnections gc = (GraphConnections) l.getConnections().get(0);
    for (float v : gc.getConnectionGraph().getElements()) {
View Full Code Here

    @Test
    public void testRandomInitializer() {
  Environment.getInstance().setUseWeightsSharedMemory(true);
  NeuralNetworkImpl nn = NNFactory.mlp(new int[] { 3, 2 }, true);
  NNRandomInitializer rand = new NNRandomInitializer(new MersenneTwisterRandomInitializer(-0.1f, 0.1f), 0.5f);
  rand.initialize(nn);

  for (Layer l : nn.getLayers()) {
      if (Util.isBias(l)) {
    Tensor t = ((FullyConnected) l.getConnections().get(0)).getWeights();
    float[] elements = t.getElements();
View Full Code Here

    t.forEach(i -> assertTrue(elements[i] >= -0.1f && elements[i] <= 0.1f && elements[i] != 0));
      }
  }

  rand = new NNRandomInitializer(new MersenneTwisterRandomInitializer(2f, 3f), new MersenneTwisterRandomInitializer(-2f, -1f));
  rand.initialize(nn);

  for (Layer l : nn.getLayers()) {
      if (Util.isBias(l)) {
    Tensor t = ((FullyConnected) l.getConnections().get(0)).getWeights();
    float[] elements = t.getElements();
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.