public Network(byte[] genes) : base(genes) { _genePointer = 0; inputLayer = new Node[4]; hiddenLayer = new Node[5]; outputLayer = new Node[3]; connections = new List <Connection>(); for (int i = 0; i < inputLayer.Length; i++) { inputLayer[i] = new InputNode(this); } for (int i = 0; i < hiddenLayer.Length; i++) { hiddenLayer[i] = new Node(this); } for (int i = 0; i < outputLayer.Length; i++) { outputLayer[i] = new Node(this); } ConnectLayers(); }
public FeedForwardNet(ref FeedForwardNet copyNet) { AbstractNode abNode; InputNode inNode = copyNet.InputNode; this.InputNode = new InputNode(ref inNode); abNode = (AbstractNode)this.InputNode; //original layer LayerOfNeurons curOrgLayer = (LayerOfNeurons)inNode.OutputNode; //copy layer LayerOfNeurons curCpyLayer = new LayerOfNeurons(ref curOrgLayer, ref abNode); while (curOrgLayer.OutputNode.GetType() == typeof(LayerOfNeurons)) { curOrgLayer = (LayerOfNeurons)curOrgLayer.OutputNode; abNode = (AbstractNode)curCpyLayer; curCpyLayer = new LayerOfNeurons(ref curOrgLayer, ref abNode); } abNode = (AbstractNode)curCpyLayer; this.OutputNode = new OutputNode(ref abNode); }
private void CreateBias() { Bias = new InputNode(Host); Bias.SetValue(1.0); Bias.ConnectTo(this, Host.GetNextGene()); }