Ejemplo n.º 1
0
        private static NetworkBase <double> Rand(NetworkBase <double> network, RandomizerOptions options = null)
        {
            if (options == null)
            {
                options = new RandomizerOptions(-1, 1);
            }

            foreach (var layer in network.Layers)
            {
                foreach (var neuron in layer.Neurons)
                {
                    var count   = neuron.GetCount();
                    var weights = new double[count];
                    for (int i = 0; i < count; i++)
                    {
                        weights[i] = options.Uniform.NextDouble();
                    }
                    neuron.SetWeights(weights);
                }
            }

            return(network);
        }
Ejemplo n.º 2
0
 public static NetworkBase <double> Randomize(this NetworkBase <double> network, RandomizerOptions options = null)
 {
     return(Rand(network, options));
 }