Exemple #1
0
 //Methods
 /// <summary>
 /// Checks consistency
 /// </summary>
 protected override void Check()
 {
     if (NumOfNeurons < 1)
     {
         throw new ArgumentException($"Invalid NumOfNeurons {NumOfNeurons.ToString(CultureInfo.InvariantCulture)}. NumOfNeurons must be GT 0.", "NumOfNeurons");
     }
     if (!FeedForwardNetworkSettings.IsAllowedActivation(ActivationCfg, out _))
     {
         throw new ArgumentException($"Specified ActivationCfg can't be used in the hidden layer of a FF network. Activation function has to be stateless and has to support derivative calculation.", "ActivationCfg");
     }
     return;
 }
Exemple #2
0
 //Methods
 /// <inheritdoc/>
 protected override void Check()
 {
     if (NumOfNeurons < 1)
     {
         throw new ArgumentException($"Invalid NumOfNeurons {NumOfNeurons.ToString(CultureInfo.InvariantCulture)}. NumOfNeurons must be GT 0.", "NumOfNeurons");
     }
     if (!FeedForwardNetwork.IsAllowedHiddenAF(ActivationCfg))
     {
         throw new ArgumentException($"Specified activation function can't be used in the hidden layer of a FF network.", "ActivationCfg");
     }
     return;
 }
Exemple #3
0
 /// <summary>
 /// See the base.
 /// </summary>
 public override int GetHashCode()
 {
     return(NumOfNeurons.GetHashCode());
 }
Exemple #4
0
 /// <summary>
 /// Generates xml element containing the settings.
 /// </summary>
 /// <param name="rootElemName">Name to be used as a name of the root element.</param>
 /// <param name="suppressDefaults">Specifies whether to ommit optional nodes having set default values</param>
 /// <returns>XElement containing the settings</returns>
 public override XElement GetXml(string rootElemName, bool suppressDefaults)
 {
     return(Validate(new XElement(rootElemName, new XAttribute("neurons", NumOfNeurons.ToString(CultureInfo.InvariantCulture)),
                                  ActivationCfg.GetXml(suppressDefaults)),
                     XsdTypeName));
 }