Exemplo n.º 1
0
            public static void Run()
            {
                var neuron1 = new Neuron()
                {
                    Value = 2.3f
                };
                var neuron2 = new Neuron()
                {
                    Value = 0.3f
                };
                var neuronLayer1 = new NeuronLayer();
                var neuronLayer2 = new NeuronLayer();

                neuronLayer1.Add(new Neuron()
                {
                    Value = 0.54f
                });
                neuronLayer2.Add(new Neuron()
                {
                    Value = 1.3f
                });
                neuronLayer2.Add(new Neuron()
                {
                    Value = 4.6f
                });

                // 1
                neuron1.ConnectTo(neuron2);
                // 2
                neuronLayer1.ConnectTo(neuron1);
                // 3
                neuron2.ConnectTo(neuronLayer1);
                // 4
                neuronLayer1.ConnectTo(neuronLayer2);
            }
        static void Main(string[] args)
        {
            //var drawing = new GraphicObjects();
            //drawing.Name = "My Drawing";

            ////single addition
            //drawing.Children.Add(new Square{Color = "Red"});
            //drawing.Children.Add(new Circle{Color = "Blue"});

            ////collection addition
            //var group = new GraphicObjects();
            //group.Children.Add(new Circle{Color = "Green"});
            //group.Children.Add(new Square{Color = "Yelllow"});

            //drawing.Children.Add(group);

            //Console.WriteLine(drawing);

            var neuron1 = new Neuron();
            var neuron2 = new Neuron();

            neuron1.ConnectTo(neuron2);

            var layer1 = new NeuronLayer();
            var layer2 = new NeuronLayer();

            neuron1.ConnectTo(layer1);
            layer1.ConnectTo(layer2);
        }
        public void BasicTest()
        {
            var neuron1 = new Neuron(0.1f);
            var neuron2 = new Neuron(0.2f);

            var neuron3 = new Neuron(0.3f);
            var neuron4 = new Neuron(0.4f);

            var neuron5 = new Neuron(0.5f);
            var neuron6 = new Neuron(0.6f);

            neuron1.ConnectTo(neuron2);
            var layer1 = new NeuronLayer();

            layer1.Add(neuron3);
            layer1.Add(neuron4);

            var layer2 = new NeuronLayer();

            layer2.Add(neuron5);
            layer2.Add(neuron6);

            neuron1.ConnectTo(layer1);
            layer1.ConnectTo(layer2);

            Assert.IsTrue(neuron1.Out.Count == 3);
            Assert.IsTrue(layer1.ToList()[0].In.Count == 1);
            Assert.IsTrue(layer2.ToList()[0].In.Count == 2);
        }
        static void Main(string[] args)
        {
            var drawing = new GraphicObject {
                Name = "My Drawing"
            };

            drawing.Children.Add(new Square {
                Color = "Red"
            });
            drawing.Children.Add(new Circle {
                Color = "Yellow"
            });

            var group = new GraphicObject();

            group.Children.Add(new Circle {
                Color = "Blue"
            });
            group.Children.Add(new Square {
                Color = "Blue"
            });
            drawing.Children.Add(group);

            WriteLine(drawing);

            var neuron1 = new Neuron();
            var neuron2 = new Neuron();
            var layer1  = new NeuronLayer();
            var layer2  = new NeuronLayer();

            neuron1.ConnectTo(neuron2);
            neuron1.ConnectTo(layer1);
            layer1.ConnectTo(layer2);
        }
Exemplo n.º 5
0
        private static void Test2()
        {
            var neuronLayer = new NeuronLayer();

            var neuronLayer2 = new NeuronLayer();

            neuronLayer.ConnectTo(neuronLayer2);

            var neuron = new Neuron();
            var otherNeuron = new Neuron();
            neuron.ConnectTo(otherNeuron);
            neuron.ConnectTo(neuronLayer);
            neuronLayer.ConnectTo(neuron);

            
        }
Exemplo n.º 6
0
        public void ConnectTo_ConnectLayerToNeuron_ValidateIn()
        {
            var neuron        = new Neuron();
            var layer         = new NeuronLayer();
            var neuronInLayer = new Neuron();

            layer.Add(neuronInLayer);
            layer.ConnectTo(neuron);

            Assert.That(neuron.In[0], Is.InstanceOf <Neuron>());
        }
Exemplo n.º 7
0
        static void Main(string[] args)
        {
            var neuron1 = new Neuron();
            var neuron2 = new Neuron();
            var layer1  = new NeuronLayer();
            var layer2  = new NeuronLayer();

            neuron1.ConnectTo(neuron2);
            neuron1.ConnectTo(layer1);
            layer1.ConnectTo(layer2);
        }
Exemplo n.º 8
0
        static void Composite()
        {
            var neuron1 = new Neuron();
            var neuron2 = new Neuron();
            var layer1  = new NeuronLayer();
            var layer2  = new NeuronLayer();

            neuron1.ConnectTo(neuron2);
            neuron1.ConnectTo(layer1);
            layer1.ConnectTo(layer2);
        }
        public void Run()
        {
            var neuron1 = new Neuron();
            var neuron2 = new Neuron();
            var layer1  = new NeuronLayer();
            var layer2  = new NeuronLayer();

            neuron1.ConnectTo(neuron2);
            neuron1.ConnectTo(layer1);
            layer1.ConnectTo(layer2);
        }
Exemplo n.º 10
0
        static void RunCompositeDesignPattern2()
        {
            Neuron neuron1 = new Neuron();
            Neuron neuron2 = new Neuron();

            neuron1.ConnectTo(neuron2);

            NeuronLayer neuronLayer1 = new NeuronLayer();
            NeuronLayer neuronLayer2 = new NeuronLayer();

            neuronLayer1.ConnectTo(neuronLayer2);
        }
Exemplo n.º 11
0
        public static void CommonInterfaceDemo()
        {
            var neuron1 = new Neuron();
            var neuron2 = new Neuron();
            var layer1  = new NeuronLayer();
            var layer2  = new NeuronLayer();

            neuron1.ConnectTo(neuron2);
            neuron1.ConnectTo(layer1);
            layer1.ConnectTo(layer2);

            WriteLine("This example does not provide any output, please check the code.");
        }
Exemplo n.º 12
0
        public static void CreateCompositeNueral()
        {
            var neuron1 = new Neuron();
            var neuron2 = new Neuron();
            var layer1  = new NeuronLayer();
            var layer2  = new NeuronLayer();

            neuron1.ConnectTo(neuron2);
            // this is possible for a single neutron is seen as an element
            // in a collection (a monoelement collection)
            neuron1.ConnectTo(layer1);
            layer1.ConnectTo(layer2);
        }
Exemplo n.º 13
0
        public void Start()
        {
            var neuron  = new Neuron();
            var neuron2 = new Neuron();

            neuron.ConnectTo(neuron2);

            var layer  = new NeuronLayer();
            var layer2 = new NeuronLayer();

            neuron.ConnectTo(layer);
            layer.ConnectTo(layer2);
        }
Exemplo n.º 14
0
        private static void Example2()
        {
            var neuron1 = new Neuron();
            var neuron2 = new Neuron();

            neuron1.ConnectTo(neuron2);

            var layer1 = new NeuronLayer();
            var layer2 = new NeuronLayer();

            neuron1.ConnectTo(layer1);
            layer1.ConnectTo(layer2);
        }
Exemplo n.º 15
0
        static void Main(string[] args)
        {
            var drawing = new GraphicObject {
                Name = "My drawing"
            };

            drawing.Children.Add(new Square {
                Color = "Red"
            });
            drawing.Children.Add(new Circle {
                Color = "Yellow"
            });

            var group = new GraphicObject();

            group.Children.Add(new Circle {
                Color = "Blue"
            });
            group.Children.Add(new Square {
                Color = "Blue"
            });
            drawing.Children.Add(group);

            Console.WriteLine(drawing);

            //// neuron and neuron layer
            var neuron1 = new Neuron();
            var neuron2 = new Neuron();

            neuron1.ConnectTo(neuron2);

            var layer1 = new NeuronLayer();
            var layer2 = new NeuronLayer();

            neuron1.ConnectTo(layer1);
            layer1.ConnectTo(layer2);

            // exercise
            IValueContainer sv = new SingleValue {
                Value = 1
            };
            IValueContainer mv = new ManyValues {
                2, 3,
            };
            var valueContainers = new List <IValueContainer> {
                sv, mv
            };

            Console.WriteLine(valueContainers.Sum());
        }
        public static void Demo2()
        {
            var neuron1 = new Neuron();
            var neuron2 = new Neuron();

            neuron1.ConnectTo(neuron2);

            var layoer1 = new NeuronLayer();
            var layoer2 = new NeuronLayer();

            // now we can mantain que connectivity besides neuron objects or list
            neuron1.ConnectTo(layoer1);
            layoer1.ConnectTo(layoer2);
        }
Exemplo n.º 17
0
        public static void NeuronExample()
        {
            var neuron1 = new Neuron();
            var neuron2 = new Neuron();

            var layer1 = new NeuronLayer();
            var layer2 = new NeuronLayer();

            // Neurons can connect to neurons
            // Neurons can connect to layers
            // Layers can connect to neurons
            // Layers can connect to layers
            neuron1.ConnectTo(neuron2);
            neuron1.ConnectTo(layer1);
            layer1.ConnectTo(layer2);
        }
Exemplo n.º 18
0
        static void MainNN(string[] args)
        {
            var neuron1 = new Neuron();
            var neuron2 = new Neuron();

            neuron1.ConnectTo(neuron2); //1

            var layer1 = new NeuronLayer();
            var layer2 = new NeuronLayer();

            // now takes 4 connect


            neuron1.ConnectTo(layer1);
            layer1.ConnectTo(layer2);
        }
Exemplo n.º 19
0
        public static void Demo()
        {
            var neuron1 = new Neuron();
            var neuron2 = new Neuron();

            neuron1.ConnectTo(neuron2); // 1 method

            var layer1 = new NeuronLayer();
            var layer2 = new NeuronLayer();

            // 4 methods to connect every other kind of object to each other
            // Requirements now are, a neuron can connect to a layer, a layer to a neuron, a layer to a layer

            // we now can connect them each other
            neuron1.ConnectTo(layer1);
            layer1.ConnectTo(layer2);
        }
        static void Main(string[] args)
        {
            // GEOMETRIC SHAPES
            var drawing = new GraphicObject {
                Name = "My Drawing"
            };

            drawing.Children.Add(new Square {
                Color = "Red"
            });
            drawing.Children.Add(new Circle {
                Color = "Yellow"
            });

            var group = new GraphicObject();

            group.Children.Add(new Circle {
                Color = "Blue"
            });
            group.Children.Add(new Square {
                Color = "Blue"
            });
            drawing.Children.Add(group);

            Console.WriteLine(drawing);

            // NEURAL NETWORKS
            var neuron1 = new Neuron();
            var neuron2 = new Neuron();
            var layer1  = new NeuronLayer();
            var layer2  = new NeuronLayer();

            neuron1.ConnectTo(neuron2);
            neuron1.ConnectTo(layer1);
            layer1.ConnectTo(layer2);

            Console.ReadLine();
        }