Пример #1
0
 public void setInputs(List <T> inputs)
 {
     for (int i = 0; i < inputs.Count; i++)
     {
         currentNode       = nodes[i] as ConstInputNeuralNode <T>;
         currentNode.value = inputs[i];
     }
 }
Пример #2
0
        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];
            }
        }