Пример #1
0
 public void ConnectWithLayer(Layer layer)
 {
     if (layer == null)
     {
         throw (new NetworkException());
     }
     foreach(Neuron neuron in _neurons)
     {
         neuron.AddInputs(layer);
     }
 }
Пример #2
0
        public NeuralNetwork(int inSize, int hiddenSize, int outSize,
               int hiddenCount)
        {
            if((inSize < 1) || (hiddenSize < 1) || (outSize < 1) || (hiddenCount < 1))
            {
                throw (new NetworkException());
            }

            inLayer = new Layer(inSize);
            outLayer = new Layer(outSize);
            hiddenLayer = new Layer[hiddenCount];
            for(int i = 0; i < hiddenCount; i++)
            {
                hiddenLayer[i] = new Layer(hiddenSize);
            }

            outLayer.ConnectWithLayer(hiddenLayer[hiddenCount - 1]);
            for (int i = (hiddenCount - 1); i > 0; i--)
            {
                hiddenLayer[i].ConnectWithLayer(hiddenLayer[i - 1]);
            }
            hiddenLayer[0].ConnectWithLayer(inLayer);
        }