public Network BuildNetwork() { for (int i = 0; i < _inputNodeInitialCount; i++) { var inputNode = new InputNode(i); _inputNodes.Add(inputNode); } for (int i = 0; i < _outPutNodeInitialCount; i++) { var outputNode = new OutputNode(i, _activationFunction, _weightAdjustFunction); _outputNodes.Add(outputNode); } for (int i = 0; i < _hiddenLayerInitialCount; i++) { _hiddenNodes[i] = new List <HiddenNode>(); for (int j = 0; j < _hiddenNodePerLayerInitialCount; j++) { _hiddenNodes[i].Add(new HiddenNode(j, _activationFunction, _weightAdjustFunction, _getRandom)); } if (i == 0) { _hiddenNodes[i].ForEach((o) => { o.AddInputNodes(_inputNodes); }); } else { _hiddenNodes[i].ForEach((o) => { o.AddInputNodes(_hiddenNodes[i - 1]); }); } } _outputNodes.ForEach((o) => { if (_hiddenLayerInitialCount == 0 || _hiddenNodePerLayerInitialCount == 0) { o.AddInputNodes(_inputNodes); } else { o.AddInputNodes(_hiddenNodes[_hiddenLayerInitialCount - 1]); } }); return(this); }
public NeuralGeneNode AddOutputNode(NeuralActivationFunction _neuralActivationFunctions) { if (OutputLayer == null) { OutputLayer = new List <NeuralGeneNode>(); } if (nodes == null) { nodes = new List <NeuralGeneNode>(); } NeuralGeneNode tmpNode = new NeuralGeneNode(_neuralActivationFunctions, nodes.Count + 1, NeuralNodeType.Output); OutputLayer.Add(tmpNode); nodes.Add(tmpNode); return(tmpNode); }
public void AddOutputsNode(int _outputSize, NeuralActivationFunction _neuralActivationFunctions) { if (OutputLayer == null) { OutputLayer = new List <NeuralGeneNode>(); } if (nodes == null) { nodes = new List <NeuralGeneNode>(); } for (int i = 0; i < _outputSize; i++) { NeuralGeneNode tmpNode = new NeuralGeneNode(_neuralActivationFunctions, nodes.Count + 1, NeuralNodeType.Output); OutputLayer.Add(tmpNode); nodes.Add(tmpNode); } }
AddNeuralLayer(int countNeurons, double initialWeight) //public NeuralLayer(int count, double initialWeight, string name = "") { OutputLayer.Add(new List <Neuron>()); var lastIndex = OutputLayer.Count - 1; weightsLayouts.Add(initialWeight); for (var i = 0; i < countNeurons; i++) { OutputLayer[lastIndex].Add(new Neuron(lastIndex, i, OutputLayer.Count)); OutputLayer[lastIndex][i].Weights = new List <double>(InputLayerDimension); for (var k = 0; k < Patterns[0].Count; k++) { OutputLayer[lastIndex][i].Weights.Add(initialWeight); } } AddDendritesToAllLayers(); }