Java Code Examples for org.neuroph.core.Layer#getNeurons()
The following examples show how to use
org.neuroph.core.Layer#getNeurons() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ResilientPropagation.java From NeurophFramework with Apache License 2.0 | 5 votes |
@Override protected void onStart() { super.onStart(); // init all stuff from superclasses // create ResilientWeightTrainingtData objects that will hold additional data (resilient specific) during the training for (Layer layer : this.neuralNetwork.getLayers()) { for (Neuron neuron : layer.getNeurons()) { for (Connection connection : neuron.getInputConnections()) { connection.getWeight().setTrainingData(new ResilientWeightTrainingtData()); } } } }
Example 2
Source File: MomentumBackpropagation.java From NeurophFramework with Apache License 2.0 | 5 votes |
@Override protected void onStart() { super.onStart(); // create MomentumTrainingData objects that will be used during the training to store previous weight value for (Layer layer : neuralNetwork.getLayers()) { for (Neuron neuron : layer.getNeurons()) { for (Connection connection : neuron.getInputConnections()) { connection.getWeight().setTrainingData(new MomentumTrainingData()); } } // for } // for }
Example 3
Source File: QuickPropagation.java From NeurophFramework with Apache License 2.0 | 5 votes |
@Override protected void onStart() { super.onStart(); //To change body of generated methods, choose Tools | Templates. for (Layer layers : neuralNetwork.getLayers()) { for (Neuron neuron : layers.getNeurons()) { for (Connection connection : neuron.getInputConnections()) { //connection.getWeight().setTrainingData(new QuickPropData()); Weight<QuickPropData> qpWeight = new Weight<>(); qpWeight.setTrainingData(new QuickPropData()); connection.setWeight(qpWeight); } } } }
Example 4
Source File: ConnectionFactory.java From NeurophFramework with Apache License 2.0 | 5 votes |
/** * Creates full connectivity between the two specified layers * * @param fromLayer * layer to connect * @param toLayer * layer to connect to */ public static void fullConnect(Layer fromLayer, Layer toLayer, boolean connectBiasNeuron) { for(Neuron fromNeuron : fromLayer.getNeurons()) { if (fromNeuron instanceof BiasNeuron) { continue; } for (Neuron toNeuron : toLayer.getNeurons()) { createConnection(fromNeuron, toNeuron); } } }
Example 5
Source File: NeuralNetworkFactory.java From NeurophFramework with Apache License 2.0 | 5 votes |
/** * Sets default input and output neurons for network (first layer as input, * last as output) */ public static void setDefaultIO(NeuralNetwork nnet) { ArrayList<Neuron> inputNeuronsList = new ArrayList<>(); Layer firstLayer = nnet.getLayerAt(0); for (Neuron neuron : firstLayer.getNeurons() ) { if (!(neuron instanceof BiasNeuron)) { // dont set input to bias neurons inputNeuronsList.add(neuron); } } List<Neuron> outputNeurons = ((Layer) nnet.getLayerAt(nnet.getLayersCount()-1)).getNeurons(); nnet.setInputNeurons(inputNeuronsList); nnet.setOutputNeurons(outputNeurons); }
Example 6
Source File: NeuralNetworkCODEC.java From NeurophFramework with Apache License 2.0 | 5 votes |
/** * Encode a network to an array. * @param network The network to encode. */ public static void network2array(NeuralNetwork network, double[] array) { int index = 0; List<Layer> layers = network.getLayers(); for (Layer layer : layers) { for (Neuron neuron : layer.getNeurons()) { for (Connection connection : neuron.getOutConnections()) { array[index++] = connection.getWeight().getValue(); } } } }
Example 7
Source File: NeuralNetworkCODEC.java From NeurophFramework with Apache License 2.0 | 5 votes |
/** * Decode a network from an array. * @param array The array used to decode. * @param network The network to decode into. */ public static void array2network(double[] array, NeuralNetwork network) { int index = 0; List<Layer> layers = network.getLayers(); for (Layer layer : layers) { for (Neuron neuron : layer.getNeurons()) { for (Connection connection : neuron.getOutConnections()) { connection.getWeight().setValue(array[index++]); //connection.getWeight().setPreviousValue(array[index++]); } } } }
Example 8
Source File: NeuralNetworkCODEC.java From NeurophFramework with Apache License 2.0 | 5 votes |
/** * Determine the array size for the given neural network. * @param network The neural network to determine for. * @return The size of the array necessary to hold that network. */ public static int determineArraySize(NeuralNetwork network) { int result = 0; List<Layer> layers = network.getLayers(); for (Layer layer : layers) { for (Neuron neuron : layer.getNeurons()) { result+=neuron.getOutConnections().size(); } } return result; }
Example 9
Source File: RandomizationSample.java From NeurophFramework with Apache License 2.0 | 5 votes |
public static void printWeights(NeuralNetwork<?> neuralNet) { for (Layer layer : neuralNet.getLayers()) { for (Neuron neuron : layer.getNeurons()) { for (Connection connection : neuron.getInputConnections()) { System.out.print(connection.getWeight().value + " "); } System.out.println(); } } }
Example 10
Source File: WeightsRandomizer.java From NeurophFramework with Apache License 2.0 | 4 votes |
/** * Iterate and randomizes all neurons in specified layer * * @param layer layer to randomize */ protected void randomize(Layer layer) { for (Neuron neuron : layer.getNeurons()) { randomize(neuron); } }
Example 11
Source File: ConnectionFactory.java From NeurophFramework with Apache License 2.0 | 3 votes |
/** * Creates full connectivity between the two specified layers * * @param fromLayer * layer to connect * @param toLayer * layer to connect to */ public static void fullConnect(Layer fromLayer, Layer toLayer) { for(Neuron fromNeuron : fromLayer.getNeurons()) { for (Neuron toNeuron : toLayer.getNeurons()) { createConnection(fromNeuron, toNeuron); } } }
Example 12
Source File: ConnectionFactory.java From NeurophFramework with Apache License 2.0 | 3 votes |
/** * Creates full connectivity between two specified layers with specified * weight for all connections * * @param fromLayer * output layer * @param toLayer * input layer * @param weightVal * connection weight value */ public static void fullConnect(Layer fromLayer, Layer toLayer, double weightVal) { for(Neuron fromNeuron : fromLayer.getNeurons()) { for (Neuron toNeuron : toLayer.getNeurons()) { createConnection(fromNeuron, toNeuron, weightVal); } } }
Example 13
Source File: ConnectionFactory.java From NeurophFramework with Apache License 2.0 | 2 votes |
/** * Creates connectivity between specified neuron and all neurons in specified layer * * @param fromNeuron * neuron to connect * @param toLayer * layer to connect to */ public static void createConnection(Neuron fromNeuron, Layer toLayer) { for (Neuron toNeuron : toLayer.getNeurons()) { ConnectionFactory.createConnection(fromNeuron, toNeuron); } }