Пример #1
0
        private static void SetRandomNeuronWeights(Layer layer)
        {
            var random = RandomHolder.Random;
            foreach (var neuron in layer.Neurons)
            {
                for (int i = 0; i < neuron.Weights.Count; i++)
                {
                    neuron.Weights[i] = random.NextDouble(-4, 4);
                }

                neuron.Bias = random.NextDouble(-4, 4);
            }
        }
Пример #2
0
 public Network(int inputsCount, int hiddenLayerNeuronCount, int outputLayerNeuronCount)
 {
     HiddenLayer = new Layer(inputsCount, hiddenLayerNeuronCount);
     OutputLayer = new Layer(hiddenLayerNeuronCount, outputLayerNeuronCount);
 }
Пример #3
0
 private static IEnumerable<double> GetLayerGenotype(Layer layer)
 {
     return layer.Neurons.SelectMany(n => n.Weights.Concat(new[] { n.Bias }));
 }