Пример #1
0
        public void RandomizeWeights(IWeightInitializer weightInitializer)
        {
            int    inputs    = Weights.GetLength(0) * Weights.GetLength(1) * Weights.GetLength(2);
            double magnitude = Math.Sqrt((double)1 / inputs);

            Weights.ForEach((i, j, k) => Weights[i, j, k] = weightInitializer.GenerateRandom(magnitude));
        }
Пример #2
0
        public Neuron(
            IActivator activator,
            IWeightInitializer weightInitializer,
            int numberOfConnections,
            LearningRateAnnealerType lrat)
        {
            Weights = new double[numberOfConnections];
            _learningRateAnnealers = new ILearningRateAnnealer[numberOfConnections];
            _learningRateAnnealers.ForEach((q, i) => _learningRateAnnealers[i] = LearningRateAnnealerFactory.Produce(lrat));
            _biasLearningRateAnnealer = LearningRateAnnealerFactory.Produce(lrat);

            double magnitude = 1 / Math.Sqrt(numberOfConnections);

            Weights.ForEach((q, i) => Weights[i] = weightInitializer.GenerateRandom(magnitude));
            _activator = activator;
        }
Пример #3
0
        public Connection(int numberOfInputs, IWeightInitializer weightInitializer)
        {
            double magnitude = 1 / Math.Sqrt(numberOfInputs);

            Weight = weightInitializer.GenerateRandom(magnitude);
        }