예제 #1
0
        public static Layer createLayer(IList<NeuronProperties> neuronPropertiesVector)
        {
            Layer layer = new Layer();

            foreach(NeuronProperties neuronProperties in neuronPropertiesVector) {
            Neuron neuron = NeuronFactory.CreateNeuron(neuronProperties);
            layer.AddNeuron(neuron);
            }

            return layer;
        }
예제 #2
0
 /// <summary>
 /// Creates forward connectivity pattern between the specified layers
 /// </summary>
 /// <param name="fromLayer">layer to connect</param>
 /// <param name="toLayer">layer to connect to</param>
 /// <param name="weightVal"></param>
 public static void ForwardConnect(Layer fromLayer, Layer toLayer, double weightVal)
 {
     for (int i = 0; i < fromLayer.NeuronsCount; i++)
     {
         Neuron fromNeuron = fromLayer.GetNeuronAt(i);
         Neuron toNeuron = toLayer.GetNeuronAt(i);
         CreateConnection(fromNeuron, toNeuron, weightVal);
     }
 }
예제 #3
0
 public static Layer createLayer(int neuronsCount, NeuronProperties neuronProperties)
 {
     Layer layer = new Layer(neuronsCount, neuronProperties);
     return layer;
 }
예제 #4
0
 /// <summary>
 /// Creates full connectivity between two specified layers with specified
 /// weight for all connections 
 /// </summary>
 /// <param name="fromLayer">output layer</param>
 /// <param name="toLayer">input layer</param>
 /// <param name="weightVal">connection weight value</param>
 public static void FullConnect(Layer fromLayer, Layer toLayer, double weightVal)
 {
     foreach (Neuron fromNeuron in fromLayer.Neurons)
     {
         foreach (Neuron toNeuron in toLayer.Neurons)
         {
             CreateConnection(fromNeuron, toNeuron, weightVal);
         }
     }
 }
예제 #5
0
 /// <summary>
 /// Creates full connectivity within layer - each neuron with all other
 /// within the same layer with the specified weight and delay values for all
 /// conections.
 /// </summary>
 /// <param name="layer"></param>
 /// <param name="weightVal"></param>
 /// <param name="delay"></param>
 public static void FullConnect(Layer layer, double weightVal, int delay)
 {
     int neuronNum = layer.NeuronsCount;
     for (int i = 0; i < neuronNum; i++)
     {
         for (int j = 0; j < neuronNum; j++)
         {
             if (j == i)
                 continue;
             Neuron from = layer.GetNeuronAt(i);
             Neuron to = layer.GetNeuronAt(j);
             CreateConnection(from, to, weightVal, delay);
         } // j
     } // i
 }
예제 #6
0
 /// <summary>
 /// Creates full connectivity between the two specified layers
 /// </summary>
 /// <param name="fromLayer">layer to connect</param>
 /// <param name="toLayer">layer to connect to</param>
 /// <param name="connectBiasNeuron"></param>
 public static void FullConnect(Layer fromLayer, Layer toLayer, bool connectBiasNeuron)
 {
     foreach (Neuron fromNeuron in fromLayer.Neurons)
     {
         if (fromNeuron is BiasNeuron) continue;
         foreach (Neuron toNeuron in toLayer.Neurons)
         {
             CreateConnection(fromNeuron, toNeuron);
         }
     }
 }
예제 #7
0
 /// <summary>
 /// Removes specified layer from network 
 /// </summary>
 /// <param name="layer">layer to remove</param>
 public void RemoveLayer(Layer layer)
 {
     this.layers.Remove(layer);
 }
예제 #8
0
 /// <summary>
 /// Returns index position of the specified layer
 /// </summary>
 /// <param name="layer">requested Layer object</param>
 /// <returns>layer position index</returns>
 public int IndexOf(Layer layer)
 {
     return this.layers.IndexOf(layer);
 }
예제 #9
0
 /// <summary>
 /// Adds layer to specified index position in network 
 /// </summary>
 /// <param name="idx">index position to add layer</param>
 /// <param name="layer">layer to add</param>
 public void AddLayer(int idx, Layer layer)
 {
     layer.ParentNetwork = this;
     this.layers.Insert(idx, layer);
 }
예제 #10
0
 /// <summary>
 /// Adds layer to neural network 
 /// </summary>
 /// <param name="layer">layer to add</param>
 public void AddLayer(Layer layer)
 {
     layer.ParentNetwork = this;
     this.layers.Add(layer);
 }