public void SetWeight(IConnectionUnderTraining connection) { var randomNumber = _randomNumberGenerator.GenerateRandomNumber(); randomNumber = (randomNumber * Math.Abs(RangeTo - RangeFrom)) + RangeFrom; connection.Weight = randomNumber; }
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; } }
private void InitializeWeight(IConnectionUnderTraining connectionUnderTraining) { _weightSetter.SetWeight(connectionUnderTraining); EventEmitter.Log(WeightInitialized, connectionUnderTraining.Name, connectionUnderTraining.Weight); }