Esempio n. 1
0
        private void CreateCustomNetwork()
        {
            LayerConfiguration        layer1     = GetLayerConfiguration(hiddenLayer1NeuronCountSelector, hiddenLayer1ActivationDropdown);
            List <LayerConfiguration> nextLayers = new List <LayerConfiguration>();

            if (hiddenLayer2CheckBox.Checked)
            {
                nextLayers.Add(GetLayerConfiguration(hiddenLayer2NeuronCountSelector, hiddenLayer2ActivationDropdown));
            }

            if (hiddenLayer3CheckBox.Checked)
            {
                nextLayers.Add(GetLayerConfiguration(hiddenLayer3NeuronCountSelector, hiddenLayer3ActivationDropdown));
            }

            var layout = new CustomNetworkLayout(layer1, nextLayers.ToArray());

            network = new NeuralNetwork(layout);
        }
Esempio n. 2
0
        public CustomNetworkLayout(LayerConfiguration firstHiddenConfig, params LayerConfiguration[] nextHiddenConfigs)
        {
            var initializer = new RandomLayerInitializer();

            layers = new List <Layer>
            {
                new Layer(784, firstHiddenConfig.NeuronCount, initializer, firstHiddenConfig.OutputActivation)
            };

            int previousLayerNeuronCount = firstHiddenConfig.NeuronCount;

            foreach (LayerConfiguration layerConfig in nextHiddenConfigs)
            {
                layers.Add(new Layer(previousLayerNeuronCount, layerConfig.NeuronCount, initializer, layerConfig.OutputActivation));
                previousLayerNeuronCount = layerConfig.NeuronCount;
            }

            layers.Add(new Layer(previousLayerNeuronCount, 10, initializer, new SigmoidActivation()));

            ConnectLayers();
        }