示例#1
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];
            }
        }
示例#2
0
        public virtual object Clone()
        {
            var ret = new NeuralNode <T>();

            ret.neuralFunction    = neuralFunction;
            ret.weigthingFunction = weigthingFunction;
            ret.InputWeigths      = InputWeigths.ToList();
            ret.output            = output;
            return(ret);
        }
示例#3
0
 public void setNode(int nodeIdx, NeuralNode <T> .NeuralFunction neuralFunction, NeuralNode <T> .WeigthingFunction weigthingFunction)
 {
     if (nodeIdx < NodeCount)
     {
         if (nodeIdx < 0)
         {
             foreach (NeuralNode <T> node in nodes)
             {
                 node.setFunctions(neuralFunction, weigthingFunction);
             }
         }
         else
         {
             nodes[nodeIdx].setFunctions(neuralFunction, weigthingFunction);
         }
     }
 }
示例#4
0
 public void setLayerFunctions(int layerIdx, int nodeIdx, NeuralNode <T> .NeuralFunction neuralFunction, NeuralNode <T> .WeigthingFunction weigthingFunction)
 {
     if (layerIdx < 0)
     {
         foreach (NeuralLayer <T> layer in neuralLayers)
         {
             layer.setNode(nodeIdx, neuralFunction, weigthingFunction);
         }
     }
     else if (layerIdx < LayerCount)
     {
         neuralLayers[layerIdx].setNode(nodeIdx, neuralFunction, weigthingFunction);
     }
     else
     {
         throw new IndexOutOfRangeException();
     }
 }
示例#5
0
 public void addNode(NeuralNode <T> node)
 {
     nodes.Add(node);
     verified = false;
 }
示例#6
0
 public void setNetworkFunctions(int layerIdx, int nodeIdx, NeuralNode <T> .NeuralFunction neuralFunction, NeuralNode <T> .WeigthingFunction weigthingFunction)
 {
     neuralNet.setLayerFunctions(layerIdx, nodeIdx, neuralFunction, weigthingFunction);
 }