/// <inheritdoc/> public override XElement GetXml(string rootElemName, bool suppressDefaults) { XElement rootElem = new XElement(rootElemName, new XAttribute("name", Name), new XAttribute("relShare", RelShare.ToString(CultureInfo.InvariantCulture)), ActivationCfg.GetXml(suppressDefaults) ); if (!suppressDefaults || !IsDefaultFiringThreshold) { rootElem.Add(new XAttribute("firingThreshold", FiringThreshold.ToString(CultureInfo.InvariantCulture))); } if (!suppressDefaults || !IsDefaultThresholdMaxRefDeepness) { rootElem.Add(new XAttribute("thresholdMaxRefDeepness", ThresholdMaxRefDeepness.ToString(CultureInfo.InvariantCulture))); } if (BiasCfg != null) { rootElem.Add(BiasCfg.GetXml("bias", suppressDefaults)); } if (RetainmentCfg != null) { rootElem.Add(RetainmentCfg.GetXml(suppressDefaults)); } rootElem.Add(PredictorsCfg.GetXml(suppressDefaults)); Validate(rootElem, XsdTypeName); return(rootElem); }
//Methods /// <inheritdoc/> protected override void Check() { if (Name.Length == 0) { throw new ArgumentException($"Name can not be empty.", "Name"); } Type activationType = ActivationCfg.GetType(); if (activationType != typeof(AFAnalogSQNLSettings) && activationType != typeof(AFAnalogElliotSettings) && activationType != typeof(AFAnalogGaussianSettings) && activationType != typeof(AFAnalogISRUSettings) && activationType != typeof(AFAnalogSigmoidSettings) && activationType != typeof(AFAnalogSincSettings) && activationType != typeof(AFAnalogSinusoidSettings) && activationType != typeof(AFAnalogTanHSettings) ) { throw new ArgumentException($"Not allowed Activation settings {activationType.Name}.", "ActivationCfg"); } if (FiringThreshold < 0 || FiringThreshold > 1) { throw new ArgumentException($"Invalid FiringThreshold {FiringThreshold.ToString(CultureInfo.InvariantCulture)}. FiringThreshold must be GE to 0 and LE to 1.", "FiringThreshold"); } if (ThresholdMaxRefDeepness < 1) { throw new ArgumentException($"Invalid ThresholdMaxRefDeepness {ThresholdMaxRefDeepness.ToString(CultureInfo.InvariantCulture)}. ThresholdMaxRefDeepness must be GT 1.", "ThresholdMaxRefDeepness"); } return; }