public static IActivationFunction CreateRandomWithinNewCategory(ActivationFunctionCategory newCategory)
        {
            var nrOfFunctions = _activationFunctionsByCategory[newCategory].Count();

            if (nrOfFunctions == 0)
            {
                throw new ArgumentException($"Category {newCategory} doesn't have any registered activation functions", nameof(newCategory));
            }

            if (nrOfFunctions == 1)
            {
                return(_activationFunctionsByCategory[newCategory].Single());
            }

            var randomIndex = _randomizer.Next(0, nrOfFunctions);

            return(_activationFunctionsByCategory[newCategory].ElementAt(randomIndex));
        }
Beispiel #2
0
 public static RandomWithinNewCategoryActivationFunctionModifier Create(ActivationFunctionCategory newActivationFunctionCategory)
 {
     return(new RandomWithinNewCategoryActivationFunctionModifier(newActivationFunctionCategory));
 }
Beispiel #3
0
 private RandomWithinNewCategoryActivationFunctionModifier(ActivationFunctionCategory newActivationFunctionCategory)
 {
     _newActivationFunctionCategory = newActivationFunctionCategory;
 }