コード例 #1
0
ファイル: WeightSetter.cs プロジェクト: garrypas/SodiumPlus
        public void SetWeight(IConnectionUnderTraining connection)
        {
            var randomNumber = _randomNumberGenerator.GenerateRandomNumber();

            randomNumber      = (randomNumber * Math.Abs(RangeTo - RangeFrom)) + RangeFrom;
            connection.Weight = randomNumber;
        }
コード例 #2
0
        public void ApplyWeightChange(IConnectionUnderTraining connection, double weightChange)
        {
            connection.UncommittedWeightChange += weightChange;

            if (double.IsNegativeInfinity(connection.UncommittedWeightChange))
            {
                connection.UncommittedWeightChange = double.MinValue;
            }
            else if (double.IsPositiveInfinity(connection.UncommittedWeightChange))
            {
                connection.UncommittedWeightChange = double.MaxValue;
            }
        }
コード例 #3
0
 private void InitializeWeight(IConnectionUnderTraining connectionUnderTraining)
 {
     _weightSetter.SetWeight(connectionUnderTraining);
     EventEmitter.Log(WeightInitialized, connectionUnderTraining.Name, connectionUnderTraining.Weight);
 }