/*
 This is a proprietary part of DataMelt package.
 License: the Creative Commons Attribution-Share Alike License; either version 3.0 of the License, 
 or any later version.
 http://creativecommons.org/licenses/by-sa/3.0/
 

Redistributions of the source code, or parts of the source codes, must retain the copyright notice, this list of conditions and the following disclaimer (all at the top of each source code) and requires the written permission from DataMelt.

Redistribution in binary form of all or parts of a class must reproduce the copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution and requires the written permission of ScaVis

Details about license agreement or commercial use are: http://jwork.org/scavis/ */ package jhpro.nnet; public class NeuronLayer implements java.io.Serializable { public NeuronLayer(int i) { neuron = new Neuron[i]; for(int j = 0; j < i; j++) neuron[j] = new Neuron(); } public void setInput(Pattern pattern) { for(int i = 0; i < neuron.length; i++) neuron[i].init(pattern.getValue(i)); } public void setInput(InputValue inputvalue) { float af[] = new float[3]; af[0] = (float)inputvalue.getX(); af[1] = (float)inputvalue.getY(); af[2] = (float)inputvalue.getZ(); for(int i = 0; i < neuron.length; i++) neuron[i].init(af[i]); } public void computeInput(NeuronLayer neuronlayer, WeightMatrix weightmatrix) { for(int i = 0; i < neuron.length; i++) neuron[i].computeInput(neuronlayer.getOutput(), weightmatrix.getInputWeights(i)); } public void computeOutput() { for(int i = 0; i < neuron.length; i++) neuron[i].activateSigmoid(); } public void computeLayerError(Pattern pattern) { for(int i = 0; i < neuron.length; i++) neuron[i].computeOutputError(pattern.getValue(i)); } public void computeLayerError(NeuronLayer neuronlayer, WeightMatrix weightmatrix) { for(int i = 0; i < neuron.length; i++) neuron[i].computeOutputError(neuronlayer.getLayerError(), weightmatrix.getOutputWeights(i)); } public float[] getOutput() { float af[] = new float[neuron.length]; for(int i = 0; i < neuron.length; i++) af[i] = neuron[i].getOutput(); return af; } public float[] getLayerError() { float af[] = new float[neuron.length]; for(int i = 0; i < neuron.length; i++) af[i] = neuron[i].getOutputError(); return af; } public int size() { return neuron.length; } Neuron neuron[]; }

Ads help maintain this website.