public NeuroItem(int num, Action <NeuroSignal> inputDataRequest, ActivationFooType activation) { ActivationMethod = activation; dataSum = new NeuroSignal(num); dataOut = new NeuroSignal(num); NeedInput = inputDataRequest; }
private void TransmitInput(NeuroSignal dataSum) { double val = 0.0; if (Role == LayerRole.Input) { if (input.TryGetValue(dataSum.ItemID, out NeuroSignal incoming)) { val = incoming.Value; } else { throw new Exception(string.Format( "Can't found input[{0}] in the layer {1}", dataSum.ItemID, this)); } } else { int row = dataSum.ItemID; // Calculate neuron input according weight matrix data foreach (INeuroTransmitter item in Dendrites) { int col = item.ItemID; val += item.Value * weights[row, col]; } } dataSum.Value = val; }