public Neuron(int numOutputs, int myIndex, ActivationFuntions activationFunctions = null) { ActiveFuns = activationFunctions ?? ActivationFuntions.Tanh; _outputWeights = new Connection[numOutputs]; _myIndex = myIndex; var random = new Random(0); for (int i = 0; i < numOutputs; i++) { _outputWeights[i] = new Connection { Weight = random.NextDouble(), } } ; }
public Net(int[] topology, ActivationFuntions activationFunctions = null) { _layers = new Layer[topology.Length]; for (int layerNum = 0; layerNum < topology.Length; ++layerNum) { _layers[layerNum] = new Layer(); int numOutputs = (layerNum == topology.Count() - 1) ? 0 : topology[layerNum + 1]; for (int i = 0; i <= topology[layerNum]; i++) { _layers[layerNum].Add(new Neuron(numOutputs, i, activationFunctions)); } _layers[layerNum].Last().OutputVal = 1; } }