Example #1
0
        public Connection(Neurone a, Neurone b, double weight)
        {
            Dendrite = a;
            Axon     = b;

            Weight = weight;
        }
Example #2
0
        public void MeshWithNextLayer()
        {
            int index = 0;

            for (int i = 0; i < Neurones.Length; i++)
            {
                Neurone current = Neurones[i];
                for (int j = 0; j < NextLayer.Neurones.Length; j++)
                {
                    var weight = Globals.GlobalRandom.Next(-1000, 1000) * 0.001;
                    if (Parent != null)
                    {
                        weight = _ParentWeights[index++];
                    }

                    current.Connections.Add(new Connection(current, NextLayer.Neurones[j], weight));
                    DNA.AddSegment(weight);
                }
            }
        }
Example #3
0
        public Layer(int n, IActivation f, DNA <double> parent = null)
        {
            NeuroneCount       = n;
            ActivationFunction = f;

            Neurones = new Neurone[n];

            Parent = parent;
            Bias   = Globals.GlobalRandom.Next(-1000, 1000) * 0.001;
            if (parent != null)
            {
                Bias           = parent.GetSegmentValue(0);
                _ParentWeights = parent.GetFullSegments(1);
            }
            DNA = new DNA <double>(new BinaryConverter());
            DNA.AddSegment(Bias);

            for (int i = 0; i < Neurones.Length; i++)
            {
                Neurones[i] = new Neurone(f, Bias);
            }
        }