public FeedforwardNeuronalNetwork CreateNeuronalNetwork(
            int inputNeurons, int outputNeurons, int firstHiddenLayerNeurons,
            int secondHiddenLayerNeurons, int evolutions = 1000, double learningRate = 0.5)
        {
            var neuronCounter = new TwoHiddenLayerNeuronCounter(inputNeurons, outputNeurons, firstHiddenLayerNeurons, secondHiddenLayerNeurons);

            return(new FeedforwardNeuronalNetwork(neuronCounter, evolutions, learningRate));
        }
Esempio n. 2
0
        public NeuronalNetworkClassifier(List <Tuple <double[], double[]> > data,
                                         int inputNeurons, int outputNeurons, int firstHiddenLayerNeurons,
                                         int secondHiddenLayerNeurons, int evolutions = 1000, double learningRate = 0.5,
                                         NeuronalNetworkMode neuronalNetworkMode      = NeuronalNetworkMode.Standard)
        {
            var neuronCounter = new TwoHiddenLayerNeuronCounter(inputNeurons, outputNeurons, firstHiddenLayerNeurons, secondHiddenLayerNeurons);

            this.data = data;
            this.feedforwardNeuronalNetwork = new FeedforwardNeuronalNetwork(neuronCounter, evolutions, learningRate, neuronalNetworkMode);
        }
        public FeedforwardNeuronalNetwork(TwoHiddenLayerNeuronCounter neuronCounter, int evolutions = 1000, double learningRate = 0.5,
                                          NeuronalNetworkMode neuronalNetworkMode = NeuronalNetworkMode.Standard)
        {
            this.mode = NeuronalCounterMode.TwoHiddenLayer;
            this.neuronalNetworkMode = neuronalNetworkMode;
            this.neuronCounter       = neuronCounter;
            this.evolutions          = evolutions;
            this.learningRate        = learningRate;
            this.inputValuesCount    = neuronCounter.InputNeuronCount;
            this.outputValuesCount   = neuronCounter.OutputNeuronCount;
            neuronalNetwork          = NeuronalNetworkModeFactory.CreateInstance(neuronalNetworkMode);
            this.neuronalNetwork.NeuronalNetworkMode = neuronalNetworkMode;
            this.neuronalNetwork.AddInputLayer(new FeedforwardLayer(activationFunction, neuronCounter.InputNeuronCount, 0));
            this.neuronalNetwork.AddHiddenLayer(new FeedforwardLayer(activationFunction, neuronCounter.FirstLayerHiddenNeuronCount, 1));
            this.neuronalNetwork.AddHiddenLayer(new FeedforwardLayer(activationFunction, neuronCounter.SecondLayerHiddenNeuronCount, 2));
            this.neuronalNetwork.AddOutputLayer(new FeedforwardLayer(activationFunction, neuronCounter.OutputNeuronCount, 3));
            this.neuronalNetwork.LearningRate = learningRate;
            this.neuronalNetwork.Evolutions   = evolutions;

            this.neuronalNetwork.RandomFillWeightMatrix();
        }