コード例 #1
0
        public void SetUp()
        {
            _testInput1 = new Connection (1, 0.1);
            _testInput2 = new Connection (2, 0.2);
            _testInputs = new List<Connection> { _testInput1, _testInput2 };

            _testOutput = new Connection (0, 1.0);
            _testOutputs = new List<Connection> { _testOutput };

            _sigmoidAlpha = TunableParameterService.Instance.SigmoidAlpha;

            _testNeuron = new MlpNeuron (_testInputs, _testOutputs, FunctionType.Sigmoid);
        }
コード例 #2
0
        IEnumerable<Neuron> CreateInputLayer()
        {
            var inputLayer = new List<Neuron>();

            foreach (var input in Inputs)
            {
                var newNeuron = new MlpNeuron(new List<Connection> { input }, new List<Connection>(), FunctionType.Linear);
                inputLayer.Add(newNeuron);
                Neurons.Add(newNeuron);
            }

            return inputLayer;
        }
コード例 #3
0
        IEnumerable<Neuron> CreateOutputLayer()
        {
            var outputLayer = new List<Neuron>();

            foreach (var output in Outputs)
            {
                var outputNode = new MlpNeuron(new List<Connection>(), new List<Connection> { output }, FunctionType.Linear);
                outputLayer.Add(outputNode);
                Neurons.Add(outputNode);
            }

            return outputLayer;
        }
コード例 #4
0
        /// <summary>
        /// Creates the hidden layers.
        /// </summary>
        IEnumerable<IEnumerable<Neuron>> CreateHiddenLayers()
        {
            var hiddenLayers = new List<IEnumerable<Neuron>>();

            for (int i=0; i<_numHiddenLayers; i++)
            {
                var hiddenNodes = new List<Neuron>();

                for (int j=0; j<_numNeuronsPerHiddenLayer; j++)
                {
                    var neuron = new MlpNeuron(new List<Connection>(), new List<Connection>(), FunctionType.Sigmoid);
                    hiddenNodes.Add(neuron);
                    Neurons.Add(neuron);
                }

                hiddenNodes.Add(new BiasNode());

                hiddenLayers.Add(hiddenNodes);
            }

            return hiddenLayers;
        }