Package com.github.neuralnetworks.calculation

Examples of com.github.neuralnetworks.calculation.ValuesProvider


    private ValuesProvider activations;
    private ValuesProvider backpropagation;

    public BackPropagationTrainer() {
  super();
  activations = new ValuesProvider();
  backpropagation = new ValuesProvider();
    }
View Full Code Here


  backpropagation = new ValuesProvider();
    }

    public BackPropagationTrainer(Properties properties) {
  super(properties);
  activations = new ValuesProvider();
  backpropagation = new ValuesProvider();
    }
View Full Code Here

  List<Connections> connections = new ArrayList<Connections>();
  connections.add(c);

  Matrix o = new Matrix(1, 2);

  ValuesProvider vp = new ValuesProvider();
  vp.addValues(c.getInputLayer(), i1);
  vp.addValues(c.getOutputLayer(), o);

  AparapiStochasticPooling2D calc = new AparapiStochasticPooling2D();
  calc.calculate(connections, vp, c.getOutputLayer());

  assertEquals(2.08, o.get(0, 0), 0.01);
View Full Code Here

  List<Connections> connections = new ArrayList<Connections>();
  connections.add(c);

  // max pooling
  ValuesProvider vp = new ValuesProvider();
  vp.addValues(c.getInputLayer(), a1);
  vp.addValues(c.getOutputLayer(), o);

  ConnectionCalculator calc = new AparapiMaxPooling2D();
  calc.calculate(connections, vp, c.getOutputLayer());

  ValuesProvider activations = new ValuesProvider();
  activations.addValues(c.getInputLayer(), a1);

  Matrix bpo = new Matrix(32, 2);

  vp = new ValuesProvider();
  vp.addValues(c.getOutputLayer(), o);
  vp.addValues(c.getInputLayer(), bpo);

  BackpropagationMaxPooling2D bp = new BackpropagationMaxPooling2D();
  bp.setActivations(activations);
View Full Code Here

  ConnectionCalculator calc = new AparapiAveragePooling2D();

  List<Connections> connections = new ArrayList<Connections>();
  connections.add(c);

  ValuesProvider vp = new ValuesProvider();
  vp.addValues(c.getInputLayer(), a1);
  Matrix o = new Matrix(8, 2);
  vp.addValues(c.getOutputLayer(), o);

  calc.calculate(connections, vp, c.getOutputLayer());

  ValuesProvider activations = new ValuesProvider();
  activations.addValues(c.getInputLayer(), a1);

  BackpropagationAveragePooling2D bp = new BackpropagationAveragePooling2D();
  bp.setActivations(activations);

  vp = new ValuesProvider();
  vp.addValues(c.getOutputLayer(), o);
  Matrix bpo = new Matrix(32, 2);
  vp.addValues(c.getInputLayer(), bpo);

  bp.calculate(connections, vp, c.getInputLayer());
View Full Code Here

  nn.setLayerCalculator(NNFactory.lcWeightedSum(nn, null));

  Conv2DConnection cc = (Conv2DConnection) nn.getInputLayer().getConnections().get(0);
  Util.fillArray(cc.getWeights(), 1);

  ValuesProvider vp = new ValuesProvider();
  vp.addValues(nn.getInputLayer(), new Matrix(new float[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25}, 1));

  Set<Layer> calculatedLayers = new HashSet<>();
  calculatedLayers.add(nn.getInputLayer());
  nn.getLayerCalculator().calculate(nn, nn.getOutputLayer(), calculatedLayers, vp);

  Matrix o = vp.getValues(nn.getOutputLayer());
  assertEquals(16, o.get(0, 0), 0.00001);
  assertEquals(24, o.get(1, 0), 0.00001);
  assertEquals(56, o.get(2, 0), 0.00001);
  assertEquals(64, o.get(3, 0), 0.00001);
    }
View Full Code Here

  Util.fillArray(secondRBM.getHiddenBiasConnections().getConnectionGraph().getElements(), 0.5f);

  Set<Layer> calculatedLayers = new HashSet<>();
  calculatedLayers.add(dbn.getInputLayer());

  ValuesProvider results = new ValuesProvider();

  results.addValues(dbn.getInputLayer(), new Matrix(new float[] {1, 0, 1}, 1));
  dbn.getLayerCalculator().calculate(dbn, dbn.getOutputLayer(), calculatedLayers, results);

  assertEquals(1.06, results.getValues(dbn.getOutputLayer()).get(0, 0), 0.00001);
  assertEquals(1.06, results.getValues(dbn.getOutputLayer()).get(1, 0), 0.00001);
    }
View Full Code Here

  Util.fillArray(((GraphConnections) secondAE.getConnection(secondAE.getOutputBiasLayer(), secondAE.getOutputLayer())).getConnectionGraph().getElements(), 0.9f);

  Set<Layer> calculatedLayers = new HashSet<>();
  calculatedLayers.add(sae.getInputLayer());

  ValuesProvider results = new ValuesProvider();
  results.addValues(sae.getInputLayer(), new Matrix(new float[] {1, 0, 1}, 1));
  sae.getLayerCalculator().calculate(sae, sae.getOutputLayer(), calculatedLayers, results);

  assertEquals(1.06, results.getValues(sae.getOutputLayer()).get(0, 0), 0.00001);
  assertEquals(1.06, results.getValues(sae.getOutputLayer()).get(1, 0), 0.00001);
    }
View Full Code Here

TOP

Related Classes of com.github.neuralnetworks.calculation.ValuesProvider

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.