예제 #1
0
        protected override void Mutation()
        {
            do
            {
                outputNeuron = Network.GetRandomNeuron();
                inputNeuron  = Network.GetRandomNeuron();
            } while ((inputNeuron == outputNeuron));

            insertedNeuron = new Neuron(ActivationFunc);

            synapseToOutput = new Synapse(insertedNeuron)
            {
                Weight = NeuralHelper.GetRandomWeigth()
            };
            outputNeuron.InputSynapses.Add(synapseToOutput);

            synapseToInput = new Synapse(inputNeuron)
            {
                Weight = NeuralHelper.GetRandomWeigth()
            };
            insertedNeuron.InputSynapses.Add(synapseToInput);



            Network.Neurons.Add(insertedNeuron);
            Network.Synapses.Add(synapseToOutput);
            Network.Synapses.Add(synapseToInput);
        }
예제 #2
0
    public void inscribeController(string controllerInput)
    {
        string[] controllerLines = controllerInput.Split('|');
        string[] neuronLines     = controllerLines[1].Split(':');
        string[] synapseLines    = controllerLines[2].Split(':');
        string[] tempSynapseLine;
        hiddenNeurons.Clear(); // All hidden neurons are cleared with each inscription
        synapses.Clear();
        netTag = controllerLines[0];
        // Create new hidden neuron population to match the inscriber
        for (int i = 0; i < int.Parse(neuronLines[0]); i++)
        {
            hiddenNeurons.Add(new HiddenNeuron());
        }

        List <Neuron> allNeurons = Tools.consolidateLists(new List <List <Neuron> > {
            sensorNeurons, effectorNeurons, hiddenNeurons
        });

        // Clear Neuron Synapses (we need only clear the sensors and effectors as hidden was cleared)
        for (int i = 0; i < sensorNeurons.Count + effectorNeurons.Count; i++)
        {
            allNeurons[i].clearSynapses();
        }

        // Create new synapses based on inscription controller
        for (int i = 0; i < synapseLines.Length; i++)
        {
            tempSynapseLine = synapseLines[i].Split('=');
            Synapse tempSyn = new Synapse(allNeurons[int.Parse(tempSynapseLine[1])], allNeurons[int.Parse(tempSynapseLine[2])], float.Parse(tempSynapseLine[0]));
            allNeurons[int.Parse(tempSynapseLine[1])].addSynapse(tempSyn);
            synapses.Add(tempSyn);
        }
    }
예제 #3
0
    private void DisplaySynapseHitEffect(SynapseLocation synapseHitLocation)
    {
        Synapse synapseObject = this.allSynapses[synapseHitLocation];

        switch (synapseObject.Mode)
        {
        case SynapseMode.OneTimePositive:
            this.DisplayOneTimePositiveHitEffect(synapseHitLocation);
            break;

        case SynapseMode.OneTimeNegative:
            this.DisplayOneTimeNegativeHitEffect(synapseHitLocation);
            break;

        case SynapseMode.Neutral:
            this.DisplayNeutralHitEffect(synapseHitLocation);
            break;

        case SynapseMode.RepetitivePositive:
            this.DisplayRepetitivePositiveHitEffect(synapseHitLocation);
            break;

        default:
            Debug.LogError("GameManager.DisplaySynapseHitEffect: Unknown synapse mode");
            break;
        }
    }
        /// <summary>
        /// Takes a neural net and creates new synapses for it
        /// </summary>
        /// <param name="net"></param>
        /// <returns></returns>
        public List <Synapse> CreateSynapses(NeuralNetwork net)
        {
            List <Synapse> result = new List <Synapse>();

            var layers = net.GetLayers();

            foreach (var layer in layers)
            {
                var currentLayerNeurons = net.GetAllNeuronsInLayer(layer);
                var nextLayerNeurons    = net.GetAllNeuronsInNextLayer(layer);

                foreach (var currentLayerNeuron in currentLayerNeurons)
                {
                    //Get the next layer
                    foreach (var nextlayerNeuron in nextLayerNeurons)
                    {
                        //Create a synapse
                        var synapse = new Synapse(currentLayerNeuron, nextlayerNeuron);

                        //Randomize the weight
                        synapse.Weight = GetRandomWeight();

                        result.Add(synapse);
                    }
                }
            }

            return(result);
        }
예제 #5
0
    /// <summary>
    /// Connect two neurons.
    /// This neuron is the output neuron of the connection.
    /// </summary>
    /// <param name="inputNeuron">Neuron that will be input neuron of the newly created connection.
    /// </param>
    public void AddInputNeuron(INeuron inputNeuron, double weight)
    {
        var synapse = new Synapse(inputNeuron, this, weight);

        Inputs.Add(synapse);
        inputNeuron.Outputs.Add(synapse);
    }
예제 #6
0
        public Synapse cloneSynapse(List <Neuron> list, int pID, int cID)
        {
            Synapse s = new Synapse(id, list[pID], list[cID]);

            s.weight = weight;
            return(s);
        }
예제 #7
0
 public EntitySpawnMutator(Synapse s)
 {
     foreach (var o in s.Options.Split(','))
     {
         _options.Add(o);
     }
 }
예제 #8
0
 private void pruneSynapse(Synapse synapseToBePruned)
 {
     // pruneSynapse ----- says on the tin
     synapseToBePruned.parent.connectedSynapses.Remove(synapseToBePruned);
     synapseToBePruned.child.connectedSynapses.Remove(synapseToBePruned);
     synapses.Remove(synapseToBePruned);
 }
예제 #9
0
        /// <summary>
        /// Connect two neurons.
        /// This neuron is the output neuron of the connection.
        /// </summary>
        /// <param name="inputNeuron">Neuron that will be input neuron of the newly created connection.
        /// </param>
        public void AddInputNeuron(INeuron inputNeuron)
        {
            var synapse = new Synapse(inputNeuron, this);

            this.Inputs.Add(synapse);
            inputNeuron.Outputs.Add(synapse);
        }
        protected override void Mutation()
        {
            randomSynapse = Network.GetRandomSynapse();



            outputNeuron    = Network.Neurons.Find(n => n.InputSynapses.Contains(randomSynapse));
            inputConnection = randomSynapse._input;

            insertedNeuron = new Neuron(ActivationFunc);

            synapseToOutput = new Synapse(insertedNeuron)
            {
                Weight = NeuralHelper.GetRandomWeigth()
            };
            outputNeuron.InputSynapses.Add(synapseToOutput);

            synapseToInput = new Synapse(inputConnection)
            {
                Weight = NeuralHelper.GetRandomWeigth()
            };
            insertedNeuron.InputSynapses.Add(synapseToInput);

            outputNeuron.InputSynapses.Remove(randomSynapse);
            Network.Synapses.Remove(randomSynapse);


            Network.Neurons.Add(insertedNeuron);
            Network.Synapses.Add(synapseToOutput);
            Network.Synapses.Add(synapseToInput);
        }
        private void UpdateSynapseWeight(Synapse synapse)
        {
            var prevDelta = synapse.WeightDelta;

            synapse.WeightDelta = learningRate * (synapse.OutputNeuron.ErrorGradient * synapse.InputNeuron.Output);
            synapse.Weight      = synapse.Weight + synapse.WeightDelta + (momentum * prevDelta);
        }
예제 #12
0
        private void ProcessSynapse(SimulationModel model, Synapse synapse, string actionName, Action <RegionModel, NeuronModel, RegionModel, NeuronModel> action)
        {
            if (!CheckSameRegion(synapse))
            {
                return;
            }

            RegionModel fromRegion;
            RegionModel toRegion;

            if (!model.Regions.TryGetModel(synapse.From.Region, out fromRegion) ||
                !model.Regions.TryGetModel(synapse.To.Region, out toRegion))
            {
                string missingRegion = fromRegion == null ? "Source" : "Target";
                LogSynapseNotProcessed(synapse, actionName, $"{missingRegion} region not found");
                return;
            }

            NeuronModel fromNeuron;
            NeuronModel toNeuron;

            // These are synapses that outside of the region of interest, they are skipped.
            if (!fromRegion.Neurons.TryGetModel(synapse.From.Neuron, out fromNeuron) ||
                !toRegion.Neurons.TryGetModel(synapse.To.Neuron, out toNeuron))
            {
                return;
            }

            action(fromRegion, fromNeuron, toRegion, toNeuron);
        }
예제 #13
0
        private ISynapse[] CreateSynapses(int[] layers, int synapsesCount, double learningRate)
        {
            var synapseIndex       = 0;
            var firstNeuronInLayer = 0;
            var synapses           = new ISynapse[synapsesCount];

            for (var i = 0; i < layers.Length - 1; i++)
            {
                var prevLayerBegin = firstNeuronInLayer;
                var nextLayerBegin = firstNeuronInLayer + layers[i];
                for (var j = prevLayerBegin; j < prevLayerBegin + layers[i]; j++)
                {
                    for (var k = nextLayerBegin; k < nextLayerBegin + layers[i + 1]; k++)
                    {
                        synapses[synapseIndex] = new Synapse
                        {
                            P = _neurons[j],
                            Q = _neurons[k],
                            N = learningRate,
                            W = _generator.Get(),
                        };
                        synapseIndex++;
                    }
                }
                firstNeuronInLayer += layers[i];
            }
            return(synapses);
        }
예제 #14
0
파일: Neuron.cs 프로젝트: ConnerOrth/Brains
        public void AddOutputNeuron(INeuron neuron)
        {
            var synapse = new Synapse(this, neuron);

            Outputs.Add(synapse);
            neuron.Inputs.Add(synapse);
        }
예제 #15
0
        public float GetWeightChange(Synapse synapse)
        {
            ArrayList homePreStat  = synapse.PreNeuron.GetStatistics(preNeuronStatisticsKey).GetData();
            ArrayList homePostStat = synapse.PostNeuron.GetStatistics(postNeuronStatisticsKey).GetData();

            float div = (float)homePostStat[0];
            float k   = (float)homePostStat[1];
            float dw  = 0;

            if (stdp.IsDopaminergic)
            {
                dw = stdp.GetWeightChangeWithDopamine(synapse, (List <int>)homePreStat[2], (List <int>)homePostStat[2]);
            }
            else
            {
                dw = stdp.GetWeightChange(synapse, (List <int>)homePreStat[2], (List <int>)homePostStat[2]);
            }
            float hm = (alpha * synapse.Weight * div + dw) * k;

            //Dynamic reduction
            //alpha *= 0.99f;

            //Console.WriteLine();
            //Console.WriteLine("Alpha = " + alpha);
            //Console.WriteLine();
            if (Network.Time < averagingWindow)
            {
                return(dw);
            }
            return(hm);
        }
예제 #16
0
        public void TestColumnSerialize()
        {
            //Thread.Sleep(5000);

            //Pool pool = new Pool(10, 10);

            Cell cell = new Cell();

            DistalDendrite dist = new DistalDendrite(cell, 0, 0, 0, 0.5, 10);

            dist.Synapses.Add(new Synapse(cell, null, 0, 0.5));
            Synapse syn = new Synapse(cell, dist, 0, 0);

            var dict = UnitTestHelpers.GetMemory();

            Column col = new Column(10, 0, 0.01, 10);

            col.ProximalDendrite          = new ProximalDendrite(0, 0.01, 10);
            col.ProximalDendrite.Synapses = new List <Synapse>();
            col.ProximalDendrite.Synapses.Add(syn);

            dict.ColumnDictionary.Add(0, col);

            var serCol = AkkaSb.Net.ActorReference.SerializeMsg(col);

            Assert.IsTrue(dict.ColumnDictionary[0].ProximalDendrite.Synapses[0].Segment != null);
        }
예제 #17
0
        public Matrix <double> ProcessInputs(Matrix <double> neuronValues, Matrix <double> nextLayerNeuronBias = null)      //If nextLayerNeuonBias = null then it is not using bias!!
        {
            //Batch Processing
            if (Synapse == null)
            {
                throw new Exception("No synapse matrix to process layer. Do not process the output layer!");
            }

            if (neuronValues.ColumnCount != NeuronCount)
            {
                throw new Exception("Incorrect number of neuron values as input for layer " + Name);
            }

            //Matrix representation calculations for improved efficiency
            Matrix <double> weights;
            Matrix <double> input;

            if (nextLayerNeuronBias != null)
            {
                weights = Synapse.Stack(nextLayerNeuronBias);                                             //Add Row of biases
                input   = neuronValues.Append(Matrix <double> .Build.Dense(neuronValues.RowCount, 1, 1)); //Add Column of 1s
            }
            else
            {
                weights = Synapse;
                input   = neuronValues;
            }

            var             layerOutput           = input * weights;
            Matrix <double> nextLayerNeuronValues = activationFunction(layerOutput);

            return(nextLayerNeuronValues);
        }
예제 #18
0
        public ISynapse CreateSynapse(INeuron source, INeuron target)
        {
            var synapse = new Synapse(source, target);

            AddSynapse(synapse);
            return(synapse);
        }
예제 #19
0
        public void testNoChangeToNonSelectedMatchingSegmentsInBurstingColumn()
        {
            TemporalMemory tm = new TemporalMemory();
            Connections    cn = new Connections();
            Parameters     p  = GetDefaultParameters(null, Parameters.KEY.PERMANENCE_DECREMENT, 0.08);

            p.Apply(cn);
            TemporalMemory.Init(cn);

            int[]  previousActiveColumns = { 0 };
            int[]  activeColumns         = { 1 };
            Cell[] previousActiveCells   = { cn.GetCell(0), cn.GetCell(1), cn.GetCell(2), cn.GetCell(3) };
            Cell[] burstingCells         = { cn.GetCell(4), cn.GetCell(5) };

            DistalDendrite selectedMatchingSegment = cn.CreateSegment(burstingCells[0]);

            cn.CreateSynapse(selectedMatchingSegment, previousActiveCells[0], 0.3);
            cn.CreateSynapse(selectedMatchingSegment, previousActiveCells[1], 0.3);
            cn.CreateSynapse(selectedMatchingSegment, previousActiveCells[2], 0.3);
            cn.CreateSynapse(selectedMatchingSegment, cn.GetCell(81), 0.3);

            DistalDendrite otherMatchingSegment = cn.CreateSegment(burstingCells[1]);
            Synapse        as1 = cn.CreateSynapse(otherMatchingSegment, previousActiveCells[0], 0.3);
            Synapse        as2 = cn.CreateSynapse(otherMatchingSegment, previousActiveCells[1], 0.3);
            Synapse        is1 = cn.CreateSynapse(otherMatchingSegment, cn.GetCell(81), 0.3);

            tm.Compute(cn, previousActiveColumns, true);
            tm.Compute(cn, activeColumns, true);

            Assert.AreEqual(0.3, as1.GetPermanence(), 0.01);
            Assert.AreEqual(0.3, as2.GetPermanence(), 0.01);
            Assert.AreEqual(0.3, is1.GetPermanence(), 0.01);
        }
예제 #20
0
        private void AddSynapse(string word, string nextWord)
        {
            word     = TrimPunctuation(word);
            nextWord = TrimPunctuation(nextWord);
            wordDictionary.TryGetValue(word, out int wordNeuronID);
            if (wordNeuronID == 0) // if there is no neuron for the word, add one
            {
                wordDictionary.Add(word, nextFreeNeuron);
                wordNeuronID = nextFreeNeuron++;
                na.GetNeuronAt(wordNeuronID).Label = word; //useful someday
            }
            wordDictionary.TryGetValue(nextWord, out int nextWordNeuronID);
            if (nextWordNeuronID == 0) // if there is no neuron for the word, add one
            {
                wordDictionary.Add(nextWord, nextFreeNeuron);
                nextWordNeuronID = nextFreeNeuron++;
                na.GetNeuronAt(nextWordNeuronID).Label = nextWord; //useful someday
            }
            Neuron  n      = na.GetNeuronAt(wordNeuronID);
            Neuron  nNext  = na.GetNeuronAt(nextWordNeuronID);
            Synapse s      = n.FindSynapse(nNext.id);
            float   weight = .1f;

            if (s != null)
            {
                weight += .1f;
            }
            n.AddSynapse(nNext.id, weight);
        }
예제 #21
0
        public void TestReinforcedSelectedMatchingSegmentInBurstingColumn()
        {
            TemporalMemory tm = new TemporalMemory();
            Connections    cn = new Connections();
            Parameters     p  = getDefaultParameters(null, KEY.PERMANENCE_DECREMENT, 0.08);

            p.apply(cn);
            tm.Init(cn);

            int[]  previousActiveColumns = { 0 };
            int[]  activeColumns         = { 1 };
            Cell[] previousActiveCells   = { cn.GetCell(0), cn.GetCell(1), cn.GetCell(2), cn.GetCell(3) };
            Cell[] burstingCells         = { cn.GetCell(4), cn.GetCell(5) };

            DistalDendrite activeSegment = cn.CreateDistalSegment(burstingCells[0]);
            Synapse        as1           = cn.CreateSynapse(activeSegment, previousActiveCells[0], 0.3);
            Synapse        as2           = cn.CreateSynapse(activeSegment, previousActiveCells[0], 0.3);
            Synapse        as3           = cn.CreateSynapse(activeSegment, previousActiveCells[0], 0.3);
            Synapse        is1           = cn.CreateSynapse(activeSegment, cn.GetCell(81), 0.3);

            DistalDendrite otherMatchingSegment = cn.CreateDistalSegment(burstingCells[1]);

            cn.CreateSynapse(otherMatchingSegment, previousActiveCells[0], 0.3);
            cn.CreateSynapse(otherMatchingSegment, previousActiveCells[1], 0.3);
            cn.CreateSynapse(otherMatchingSegment, cn.GetCell(81), 0.3);

            tm.Compute(previousActiveColumns, true);
            tm.Compute(activeColumns, true);

            Assert.AreEqual(0.4, as1.Permanence, 0.01);
            Assert.AreEqual(0.4, as2.Permanence, 0.01);
            Assert.AreEqual(0.4, as3.Permanence, 0.01);
            Assert.AreEqual(0.22, is1.Permanence, 0.001);
        }
예제 #22
0
    private void ProcessSynapseHit(SynapseLocation synapseHitLocation)
    {
        Synapse synapseObject = this.allSynapses[synapseHitLocation];

        synapseObject.HitSynapse();

        switch (synapseObject.Mode)
        {
        case SynapseMode.OneTimePositive:
            this.ProcessOneTimePositiveHit(synapseHitLocation);
            break;

        case SynapseMode.OneTimeNegative:
            this.ProcessOneTimeNegativeHit(synapseHitLocation);
            break;

        case SynapseMode.Neutral:
            this.ProcessNeutralHit(synapseHitLocation);
            break;

        case SynapseMode.RepetitivePositive:
            this.ProcessRepetitivePositiveHit(synapseHitLocation);
            break;

        default:
            Debug.LogError("GameManager.ProcessSynapseHit: Unknown synapse mode");
            break;
        }
    }
예제 #23
0
 public Neuron(double value = 0, Synapse connection = null)
 {
     this.Value      = value;
     this.Connection = connection;
     this.Dendrites  = dendrites;
     this.Bias       = bias;
 }
예제 #24
0
 public void AddSynapse(string name, Synapse synapse)
 {
     SynapseNames.Add(name);
     synapses.Add(synapse);
     Weights.Add(new List <float>());
     Weights.Last().Add(synapse.Weight);
 }
예제 #25
0
        /// <summary>
        /// Connect two neurons.
        /// This neuron is the input neuron of the connection.
        /// </summary>
        /// <param name="outputNeuron">Neuron that will be output neuron of the newly created connection.
        /// </param>
        public void AddOutputNeuron(INeuron outputNeuron)
        {
            var synapse = new Synapse(this, outputNeuron);

            this.Outputs.Add(synapse);
            outputNeuron.Inputs.Add(synapse);
        }
        protected override void Mutation()
        {
            synapse        = Network.GetRandomSynapse();
            oldDestination = synapse._input;

            synapse._input = Network.GetRandomNode();
        }
예제 #27
0
        public override void Connect(Layer inLayer)
        {
            if (inLayer.Shape != InputShape)
            {
                throw new ShapeMismatchException(nameof(inLayer));
            }

            ShapedArray <Neuron> padded = Padder.PadArray(inLayer.Neurons.ToShape(Shape), Paddings, () => new Neuron()
            {
                OutVal = PadVal
            });

            var inConnections = new ShapedArray <List <Synapse> >(PaddedShape, () => new List <Synapse>());

            IndexGen.ByStrides(PaddedShape, Strides, KernelShape).ForEach((idxKernel, i) =>
            {
                Neuron outN = base.Neurons[i];

                outN.InSynapses = IndexGen.ByStart(KernelShape, Array <int> .FromRef(idxKernel)).Select((idx, j) =>
                {
                    var S = new Synapse(padded[idx], outN);
                    inConnections[idx].Add(S);
                    return(S);
                });
            });

            padded.ForEach((N, i) => N.OutSynapses = Array <Synapse> .FromRef(inConnections[i].ToArray()));
        }
예제 #28
0
        public void testReinforcedCorrectlyActiveSegments()
        {
            TemporalMemory tm = new TemporalMemory();
            Connections    cn = new Connections();
            Parameters     p  = GetDefaultParameters(null, Parameters.KEY.INITIAL_PERMANENCE, 0.2);

            p = GetDefaultParameters(p, Parameters.KEY.MAX_NEW_SYNAPSE_COUNT, 4);
            p = GetDefaultParameters(p, Parameters.KEY.PERMANENCE_DECREMENT, 0.08);
            p = GetDefaultParameters(p, Parameters.KEY.PREDICTED_SEGMENT_DECREMENT, 0.02);
            p.Apply(cn);
            TemporalMemory.Init(cn);

            int[]  previousActiveColumns = { 0 };
            int[]  activeColumns         = { 1 };
            Cell[] previousActiveCells   = { cn.GetCell(0), cn.GetCell(1), cn.GetCell(2), cn.GetCell(3) };
            Cell   activeCell            = cn.GetCell(5);

            DistalDendrite activeSegment = cn.CreateSegment(activeCell);
            Synapse        as1           = cn.CreateSynapse(activeSegment, previousActiveCells[0], 0.5);
            Synapse        as2           = cn.CreateSynapse(activeSegment, previousActiveCells[1], 0.5);
            Synapse        as3           = cn.CreateSynapse(activeSegment, previousActiveCells[2], 0.5);
            Synapse        is1           = cn.CreateSynapse(activeSegment, cn.GetCell(81), 0.5);

            tm.Compute(cn, previousActiveColumns, true);
            tm.Compute(cn, activeColumns, true);

            Assert.AreEqual(0.6, as1.GetPermanence(), 0.1);
            Assert.AreEqual(0.6, as2.GetPermanence(), 0.1);
            Assert.AreEqual(0.6, as3.GetPermanence(), 0.1);
            Assert.AreEqual(0.42, is1.GetPermanence(), 0.001);
        }
예제 #29
0
        private static void ProcessSynapseState(Synapse synapse)
        {
            if (synapse == null)
            {
                SendOutput($"Unknown synapse {Params[1]}");

                return;
            }

            switch (Params[0])
            {
            case "state":
                break;

            case "toggle":
                synapse.IsEnabled = !synapse.IsEnabled;
                break;

            case "disable":
                synapse.IsEnabled = false;
                break;

            case "enable":
                synapse.IsEnabled = true;
                break;
            }

            SendOutput($"Synapse {synapse.Name} is {(synapse.IsEnabled ? "Enabled" : "Disabled")}");
        }
예제 #30
0
        public void Constructor_WeightPassed_WeightCreated()
        {
            var fromNeruonMock = new Mock <INeuron>();
            var toNeruonMock   = new Mock <INeuron>();
            var connection     = new Synapse(fromNeruonMock.Object, toNeruonMock.Object, 111);

            Assert.AreEqual(111, connection.Weight);
        }
예제 #31
0
      private void _compute(NeuralOutputHolder holder, NeuralLayer layer, NVector input, Synapse source) {
         PreProcessLayer(layer, input, source);

         foreach (var synapse in layer.OutputSynapses) {
            if (!holder.Results.ContainsKey(synapse)) {
               var nextLayer = synapse.OutputLayer;
               var pattern = synapse.Compute(input);
               pattern = synapse.OutputLayer.Compute(pattern);
               synapse.OutputLayer.Process(pattern);
               holder.Results[synapse] = input;
               _compute(holder, synapse.OutputLayer, pattern, synapse);

               if (nextLayer == Network.OutputLayer) {
                  holder.Output = pattern;
               }
            }
         }
      }
예제 #32
0
 /// <summary>Can be overridden by subclasses. Usually used to implement recurrent layers.</summary>
 public virtual void PreProcessLayer(NeuralLayer layer, NVector input, Synapse source) {
 }
예제 #33
0
 protected virtual double Sum(Synapse[] synapses)
 {
     double sum = Bias;
     foreach (var syn in synapses) sum += syn.Output;
     return sum;
 }
 protected override double Sum(Synapse[] synapses)
 {
     return Input = base.Sum(synapses);
 }
예제 #35
0
 protected sealed override bool GenerateOutput(Synapse[] inputConnections, Synapse[] outputConnections, out double output)
 {
     output = Activation(Sum(inputConnections));
     return true;
 }
예제 #36
0
 public Synapse SynapseTo(Neuron neuron)
 {
     Synapse synapse = new Synapse(this, neuron);
     this.outputSynapses.Add(synapse);
     neuron.inputSynapses.Add(synapse);
     return synapse;
 }