Exemplo n.º 1
0
 public Connection(Weight weight,Link previous,NeuronBase next)
 {
     Utility.Verify(()=> weight!=null && previous!=null && next!=null);
     Weight=weight;
     Next=next;
     Previous=previous;
 }
Exemplo n.º 2
0
 void Connect(Link pre,Node post,Weight weight)
 {
     Connection i=new Connection(weight);
     pre.Next[Utility.FirstNull(pre.Next)]=i;
     post.Previous[Utility.FirstNull(post.Previous)]=i;
     i.Previous=pre;
     i.Next=post;
     i.Identity=string.Format("{0} --> {1}",i.Previous.Identity,i.Next.Identity);
 }
Exemplo n.º 3
0
 void Map(Link a,Link b,Weight weight,Dictionary<Link,List<Connection>> map)
 {
     Connection connection=new Connection(weight,a,(NeuronBase)b);
     if(!map.ContainsKey(a))
         map[a]=new List<Connection>();
     map[a].Add(connection);
     if(!map.ContainsKey(b))
         map[b]=new List<Connection>();
     map[b].Add(connection);
 }
Exemplo n.º 4
0
 void ConnectKernel(Link[] kernel,Node node,Weight[] weights, Bias bias,Dictionary<Link,int> ccd)
 {
     int l=kernel.Length;
     if(bias!=null)
         l++;
     node.Previous=new Connection[l];
     for(var i=0;i<kernel.Length;i++) {
         kernel[i].Next=kernel[i].Next??new Connection[ccd[kernel[i]]];
         Connect(kernel[i],node,weights[i]);
     }
     if(bias!=null)
         Connect(bias,node,weights[kernel.Length]);
 }