Java Code Examples for org.neuroph.core.NeuralNetwork#getLayers()
The following examples show how to use
org.neuroph.core.NeuralNetwork#getLayers() .
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: NetworkUtils.java From developerWorks with Apache License 2.0 | 6 votes |
/** * Returns a NxNxNxN style string showing the layer structure * of the specified network. * * @param network * @return */ public static String getNetworkStructure(NeuralNetwork<BackPropagation> network) { StringBuilder sb = new StringBuilder(); // // First the inputs if (network != null) { sb.append(network.getInputsCount()); // // Now for the hidden layers for (Layer layer : network.getLayers()) { sb.append("x"); sb.append(layer.getNeuronsCount()); } // // Finally, the outputs sb.append("x"); sb.append(network.getOutputsCount()); } return sb.toString(); }
Example 2
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 3
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 4
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 5
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 6
Source File: WeightsRandomizer.java From NeurophFramework with Apache License 2.0 | 4 votes |
/** * Iterates and randomizes all layers in specified network * * @param neuralNetwork neural network to randomize */ public void randomize(NeuralNetwork<?> neuralNetwork) { for (Layer layer : neuralNetwork.getLayers()) { randomize(layer); } }