Exemple #1
0
 public void InitialiseHiddenLayer(int numberOfInputs, IActivationFunction activationFunction)
 {
     for (int i = 0; i < Nodes.Length; i++)
     {
         Nodes[i] = new SigmoidNode(numberOfInputs, activationFunction);
     }
 }
Exemple #2
0
        public MatrixBrain(int xInputs, int yInputs, List <int> numberOfNodesInEachLayer, IActivationFunction activationFunction)
        {
            HiddenLayers = new List <HiddenLayer>();

            var numberOfInputs = xInputs * yInputs;

            foreach (var number in numberOfNodesInEachLayer)
            {
                HiddenLayers.Add(new HiddenLayer(number));
            }

            HiddenLayers[0].InitialiseHiddenLayer(numberOfInputs, activationFunction);

            for (int i = 1; i < numberOfNodesInEachLayer.Count; i++)
            {
                HiddenLayers[i].InitialiseHiddenLayer(HiddenLayers[i - 1].Nodes.Length, activationFunction);
            }

            OutputNode = new SigmoidNode(HiddenLayers[HiddenLayers.Count - 1].Nodes.Length, activationFunction);
        }