Example #1
0
        public NeuroNetwork()
        {
            data = new Dictionary <int, INeuroLayer>();

            NeuroLayer L1 = new NeuroLayer(1, 3, 3, LayerRole.Input);
            NeuroLayer L2 = new NeuroLayer(2, 3, 3, LayerRole.Inner);
            NeuroLayer L3 = new NeuroLayer(3, 3, 3, LayerRole.Output);

            L1.NeuroImpulse += L2.ProcessData;
            L2.NeuroImpulse += L3.ProcessData;

            data.Add(L1.LayerID, L1);
            data.Add(L2.LayerID, L2);
            data.Add(L3.LayerID, L3);


            layerFirst = L1;
            layerLast  = L3;

            Dendrites     = layerFirst.Dendrites;
            SynapticKnobs = layerLast.SynapticKnobs;

            layerLast.NeuroImpulse += (knobs) =>
            { NeuroImpulse?.Invoke(knobs); };
        }
Example #2
0
        private void ProcessInputData(IEnumerable <INeuroTransmitter> incoming)
        {
            // 1) In the begining we must accept incoming data values
            foreach (INeuroTransmitter item in incoming)
            {
                if (input.TryGetValue(item.ItemID, out NeuroSignal signalIn))
                {
                    signalIn.Value = item.Value;
                }
            }

            // 2) Next, we must calculate outputs
            foreach (NeuroItem core in nucleus.Values)
            {
                core.ProcessData();

                if (output.TryGetValue(core.Number, out NeuroSignal signalOut))
                {
                    signalOut.Value = core.Axon.Value;
                }
            }

            // 3) Then, we must notify next level or user class
            NeuroImpulse?.Invoke(SynapticKnobs);
        }