public void createFromTopology() { neuralLayers = new NeuralLayer <T> [topology.LayerCount]; if (!topology.Verified) { topology.verify(); } NeuralNode <T> currentNode; TopologyEntry currentEntry; int currentLayer; for (int i = 0; i < topology.Count; i++) { currentEntry = topology.adj_M[i]; currentLayer = currentEntry.layer; if (neuralLayers[currentLayer] == null) { if (currentLayer == 0) { neuralLayers[currentLayer] = new InputLayer <T>(); } else { neuralLayers[currentLayer] = new NeuralLayer <T>(); } } if (topology.adj_M[i].layer == 0) { currentNode = new ConstInputNeuralNode <T>(); } else { if (topology.adj_M[i].memoryDepth > 0) { currentNode = new MemoryNode <T>(topology.adj_M[i].memoryDepth); } else { currentNode = new NeuralNode <T>(); } foreach (float w in currentEntry.adj_V) { if (!float.IsNaN(w)) { currentNode.InputWeigths.Add(w); } } } neuralLayers[currentLayer].addNode(currentNode); } for (int i = 1; i < topology.LayerCount; i++) { neuralLayers[i].inputLayer = neuralLayers[i - 1]; } }
public override object Clone() { var ret = new MemoryNode <T>(memoryDepth); foreach (T t in memoryQueue) { ret.memoryQueue.Enqueue(t); } ret.neuralFunction = neuralFunction; ret.weigthingFunction = weigthingFunction; ret.InputWeigths = InputWeigths.ToList(); ret.output = output; return(ret); }