Esempio n. 1
0
        private void BindClassicNet()
        {
            AlltoAllBinding(InputLayer, HiddenLayers[0]);

            if (HiddenLayers.Count > 1)
            {
                for (int i = 0; i < HiddenLayers.Count - 1; i++)
                {
                    AlltoAllBinding(HiddenLayers[i], HiddenLayers[i + 1]);
                }
            }

            AlltoAllBinding(HiddenLayers.Last(), OutputLayer);
        }
Esempio n. 2
0
        private void BindReccNet()
        {
            AlltoAllBinding(InputLayer, HiddenLayers[0]);

            if (HiddenLayers.Count > 1)
            {
                for (int i = 0; i < HiddenLayers.Count - 1; i++)
                {
                    for (int j = i + 1; j < HiddenLayers.Count; j++)
                    {
                        AlltoAllBinding(HiddenLayers[i], HiddenLayers[j]);
                    }
                }
            }

            AlltoAllBinding(HiddenLayers.Last(), OutputLayer);
        }
Esempio n. 3
0
        public Network(int inputSize, int[] hiddenSizes, int outputSize, double learnRate = 0.4, double momentum = 0.9)
        {
            this.LearnRate    = learnRate;
            this.Momentum     = momentum;
            this.InputLayer   = new List <Neuron>();
            this.HiddenLayers = new List <List <Neuron> >();
            this.OutputLayer  = new List <Neuron>();

            for (var i = 0; i < inputSize; i++)
            {
                InputLayer.Add(new Neuron());
            }

            var firstHiddenLayer = new List <Neuron>();

            for (var i = 0; i < hiddenSizes[0]; i++)
            {
                firstHiddenLayer.Add(new Neuron(InputLayer));
            }

            HiddenLayers.Add(firstHiddenLayer);

            for (var i = 1; i < hiddenSizes.Length; i++)
            {
                var hiddenLayer = new List <Neuron>();
                for (var j = 0; j < hiddenSizes[i]; j++)
                {
                    hiddenLayer.Add(new Neuron(HiddenLayers[i - 1]));
                }
                HiddenLayers.Add(hiddenLayer);
            }

            for (var i = 0; i < outputSize; i++)
            {
                OutputLayer.Add(new Neuron(HiddenLayers.Last()));
            }
        }