コード例 #1
0
ファイル: Network.cs プロジェクト: ngkolev/smartworld
        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
ファイル: Network.cs プロジェクト: ngkolev/smartworld
 public Network(int inputsCount, int hiddenLayerNeuronCount, int outputLayerNeuronCount)
 {
     HiddenLayer = new Layer(inputsCount, hiddenLayerNeuronCount);
     OutputLayer = new Layer(hiddenLayerNeuronCount, outputLayerNeuronCount);
 }
コード例 #3
0
ファイル: Agent.cs プロジェクト: ngkolev/smartworld
 private static IEnumerable<double> GetLayerGenotype(Layer layer)
 {
     return layer.Neurons.SelectMany(n => n.Weights.Concat(new[] { n.Bias }));
 }