Package tv.floe.metronome.classification.neuralnetworks.core

Examples of tv.floe.metronome.classification.neuralnetworks.core.NeuralNetwork


  public void testCollectNetworks() throws Exception {

 
    NeuralNetworkUtil util = new NeuralNetworkUtil();
   
    NeuralNetwork nn0 =  buildXORMLP();
    nn0.getLayerByIndex(1).getNeuronAt(0).getInConnections().get(0).setWeight(new Weight(0));
    nn0.getLayerByIndex(1).getNeuronAt(0).getInConnections().get(1).setWeight(new Weight(1));
    util.AccumulateWorkerNetwork( nn0 );
   
   
   
   
View Full Code Here


  @Test
  public void testAverageTwoCollectedNetworks() throws Exception {
   
    NeuralNetworkUtil util = new NeuralNetworkUtil();

    NeuralNetwork nn0 =  buildXORMLP();
    nn0.getLayerByIndex(1).getNeuronAt(0).getInConnections().get(0).setWeight(new Weight(0));
    nn0.getLayerByIndex(1).getNeuronAt(0).getInConnections().get(1).setWeight(new Weight(1));
   
    nn0.getLayerByIndex(1).getNeuronAt(1).getInConnections().get(0).setWeight(new Weight(2));
    nn0.getLayerByIndex(1).getNeuronAt(1).getInConnections().get(1).setWeight(new Weight(3));
   
    nn0.getLayerByIndex(1).getNeuronAt(2).getInConnections().get(0).setWeight(new Weight(4));
    nn0.getLayerByIndex(1).getNeuronAt(2).getInConnections().get(1).setWeight(new Weight(5));

    // output layer
    nn0.getLayerByIndex(2).getNeuronAt(0).getInConnections().get(0).setWeight(new Weight(0.1));
    nn0.getLayerByIndex(2).getNeuronAt(0).getInConnections().get(1).setWeight(new Weight(0.2));
    nn0.getLayerByIndex(2).getNeuronAt(0).getInConnections().get(2).setWeight(new Weight(0.3));
   
   
    util.AccumulateWorkerNetwork( nn0 );

    NeuralNetwork nn1 =  buildXORMLP();
    nn1.getLayerByIndex(1).getNeuronAt(0).getInConnections().get(0).setWeight(new Weight(1));
    nn1.getLayerByIndex(1).getNeuronAt(0).getInConnections().get(1).setWeight(new Weight(0));

    nn1.getLayerByIndex(1).getNeuronAt(1).getInConnections().get(0).setWeight(new Weight(4));
    nn1.getLayerByIndex(1).getNeuronAt(1).getInConnections().get(1).setWeight(new Weight(5));
   
    nn1.getLayerByIndex(1).getNeuronAt(2).getInConnections().get(0).setWeight(new Weight(6));
    nn1.getLayerByIndex(1).getNeuronAt(2).getInConnections().get(1).setWeight(new Weight(7));

    // output layer
    nn1.getLayerByIndex(2).getNeuronAt(0).getInConnections().get(0).setWeight(new Weight(0.4));
    nn1.getLayerByIndex(2).getNeuronAt(0).getInConnections().get(1).setWeight(new Weight(0.6));
    nn1.getLayerByIndex(2).getNeuronAt(0).getInConnections().get(2).setWeight(new Weight(0.8));
   
   
    util.AccumulateWorkerNetwork( nn1 );
   
   
View Full Code Here

  @Test
  public void testAverageThreeCollectedNetworks() throws Exception {
   
    NeuralNetworkUtil util = new NeuralNetworkUtil();

    NeuralNetwork nn0 =  buildXORMLP();
    nn0.getLayerByIndex(1).getNeuronAt(0).getInConnections().get(0).setWeight(new Weight(0));
    nn0.getLayerByIndex(1).getNeuronAt(0).getInConnections().get(1).setWeight(new Weight(1));
/*   
    nn0.getLayerByIndex(1).getNeuronAt(1).getInConnections().get(0).setWeight(new Weight(2));
    nn0.getLayerByIndex(1).getNeuronAt(1).getInConnections().get(1).setWeight(new Weight(3));
   
    nn0.getLayerByIndex(1).getNeuronAt(2).getInConnections().get(0).setWeight(new Weight(4));
    nn0.getLayerByIndex(1).getNeuronAt(2).getInConnections().get(1).setWeight(new Weight(5));

    // output layer
    nn0.getLayerByIndex(2).getNeuronAt(0).getInConnections().get(0).setWeight(new Weight(0.1));
    nn0.getLayerByIndex(2).getNeuronAt(0).getInConnections().get(1).setWeight(new Weight(0.2));
    nn0.getLayerByIndex(2).getNeuronAt(0).getInConnections().get(2).setWeight(new Weight(0.3));
    */
   
    util.AccumulateWorkerNetwork( nn0 );

    NeuralNetwork nn1 =  buildXORMLP();
    nn1.getLayerByIndex(1).getNeuronAt(0).getInConnections().get(0).setWeight(new Weight(1));
    nn1.getLayerByIndex(1).getNeuronAt(0).getInConnections().get(1).setWeight(new Weight(0));
/*
    nn1.getLayerByIndex(1).getNeuronAt(1).getInConnections().get(0).setWeight(new Weight(4));
    nn1.getLayerByIndex(1).getNeuronAt(1).getInConnections().get(1).setWeight(new Weight(5));
   
    nn1.getLayerByIndex(1).getNeuronAt(2).getInConnections().get(0).setWeight(new Weight(6));
    nn1.getLayerByIndex(1).getNeuronAt(2).getInConnections().get(1).setWeight(new Weight(7));

    // output layer
    nn1.getLayerByIndex(2).getNeuronAt(0).getInConnections().get(0).setWeight(new Weight(0.4));
    nn1.getLayerByIndex(2).getNeuronAt(0).getInConnections().get(1).setWeight(new Weight(0.6));
    nn1.getLayerByIndex(2).getNeuronAt(0).getInConnections().get(2).setWeight(new Weight(0.8));
   
*/   
    util.AccumulateWorkerNetwork( nn1 );
   

    NeuralNetwork nn2 =  buildXORMLP();
    nn2.getLayerByIndex(1).getNeuronAt(0).getInConnections().get(0).setWeight(new Weight(2));
    nn2.getLayerByIndex(1).getNeuronAt(0).getInConnections().get(1).setWeight(new Weight(5));
    util.AccumulateWorkerNetwork( nn2 );
   
    //NeuralNetwork nn_out = util.AverageNetworkWeights();
   
    NetworkAccumulator accumNet = NetworkAccumulator.buildAveragingNetworkFromConf(nn0.getConfig());
View Full Code Here

    c.setConfValue("neuronType", Neuron.class);
    c.setConfValue("networkType", NeuralNetwork.NetworkType.MULTI_LAYER_PERCEPTRON);
    c.setConfValue("layerNeuronCounts", "2,3,1" );
    c.parse(null);
   
    NeuralNetwork nn = new MultiLayerPerceptronNetwork();
   
    try {
      nn.buildFromConf(c);
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
   
View Full Code Here

    c.setConfValue("neuronType", Neuron.class);
    c.setConfValue("networkType", NeuralNetwork.NetworkType.MULTI_LAYER_PERCEPTRON);
    c.setConfValue("layerNeuronCounts", "2,3,1" );
    c.parse(null);
   
    NeuralNetwork nn = new MultiLayerPerceptronNetwork();
   
    try {
      nn.buildFromConf(c);
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    /*
 
View Full Code Here

    }
   
    // TODO: we need some sort of factory setup to rebuild a network based on
    // the config object
    // create accumulation network to return
    NeuralNetwork averaged_network = this.buildAveragingNetworkFromConf(this.worker_networks.get(0).getConfig());
    // mock up the layer count / neuron counts
   
   
    for (int x = 0; x < this.worker_networks.size(); x++ ) {
     
View Full Code Here

TOP

Related Classes of tv.floe.metronome.classification.neuralnetworks.core.NeuralNetwork

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.