public NeuralNetworkLayer() { ParentLayer = null; ChildLayer = null; LinearOutput = false; UseMomentum = false; MomentumFactor = 0.9; }
public void Initialize(int NumNodes, NeuralNetworkLayer parent, NeuralNetworkLayer child) { int i, j; NeuronValues = new double[NumberOfNodes]; DesiredValues = new double[NumberOfNodes]; Errors = new double[NumberOfNodes]; if (parent != null) { ParentLayer = parent; } if (child != null) { ChildLayer = child; Weights = new double[NumberOfNodes][]; WeightChanges = new double[NumberOfNodes][]; for (i = 0; i < NumberOfNodes; i++) { Weights[i] = new double[NumberOfChildNodes]; WeightChanges[i] = new double[NumberOfChildNodes]; } BiasValues = new double[NumberOfChildNodes]; BiasWeights = new double[NumberOfChildNodes]; } else { Weights = null; BiasValues = null; BiasWeights = null; WeightChanges = null; } for (i = 0; i < NumberOfNodes; i++) { NeuronValues[i] = 0; DesiredValues[i] = 0; Errors[i] = 0; if (ChildLayer != null) { for (j = 0; j < NumberOfChildNodes; j++) { Weights[i][j] = 0; WeightChanges[i][j] = 0; } } } if (ChildLayer != null) { for (j = 0; j < NumberOfChildNodes; j++) { BiasValues[j] = 1; BiasWeights[j] = 0; } } }
public NeuralNetworkLayer(int numberOfNeurons, bool linearOutput = false, bool useMomentum = false, double momentumFactor = 0.9) { ParentLayer = null; ChildLayer = null; LinearOutput = linearOutput; UseMomentum = useMomentum; MomentumFactor = momentumFactor; NumberOfNodes = numberOfNeurons; }