/// <summary> /// Creates an initialized instance. /// </summary> /// <param name="elem">Xml element containing the initialization settings</param> public ForecastTaskSettings(XElement elem) { //Validation XElement settingsElem = Validate(elem, XsdTypeName); //Parsing //Filter XElement filterSettingsElem = settingsElem.Elements().First(); switch (filterSettingsElem.Name.LocalName) { case "binFeature": FeatureFilterCfg = new BinFeatureFilterSettings(filterSettingsElem); break; case "enumFeature": FeatureFilterCfg = new EnumFeatureFilterSettings(filterSettingsElem); break; case "realFeature": FeatureFilterCfg = new RealFeatureFilterSettings(filterSettingsElem); break; default: throw new InvalidOperationException($"Feature filter element not found."); } //Networks XElement forecastNetworksSettingsElem = settingsElem.Elements("networks").FirstOrDefault(); NetworksCfg = forecastNetworksSettingsElem == null ? new ForecastNetworksSettings() : new ForecastNetworksSettings(forecastNetworksSettingsElem); return; }
//Constructors /// <summary> /// Creates an initialized instance /// </summary> /// <param name="featureFilterCfg">Output feature filter settings</param> /// <param name="networksCfg">Forecasting networks settings</param> public ForecastTaskSettings(IFeatureFilterSettings featureFilterCfg, ForecastNetworksSettings networksCfg = null ) { FeatureFilterCfg = (IFeatureFilterSettings)featureFilterCfg.DeepClone(); NetworksCfg = networksCfg == null ? new ForecastNetworksSettings() : (ForecastNetworksSettings)networksCfg.DeepClone(); return; }
//Constructors /// <summary> /// Creates an initialized instance /// </summary> /// <param name="classificationNetworksCfg">Default classification networks settings</param> /// <param name="forecastNetworksCfg">Default forecast networks settings</param> public DefaultNetworksSettings(ClassificationNetworksSettings classificationNetworksCfg = null, ForecastNetworksSettings forecastNetworksCfg = null ) { ClassificationNetworksCfg = classificationNetworksCfg == null ? new ClassificationNetworksSettings() : (ClassificationNetworksSettings)classificationNetworksCfg.DeepClone(); ForecastNetworksCfg = forecastNetworksCfg == null ? new ForecastNetworksSettings() : (ForecastNetworksSettings)forecastNetworksCfg.DeepClone(); return; }
/// <summary> /// The deep copy constructor /// </summary> /// <param name="source">Source instance</param> public ForecastNetworksSettings(ForecastNetworksSettings source) : this() { foreach (FeedForwardNetworkSettings netCfg in source.NetworkCfgCollection) { NetworkCfgCollection.Add((FeedForwardNetworkSettings)netCfg.DeepClone()); } return; }
/// <summary> /// Creates an initialized instance. /// </summary> /// <param name="elem">Xml element containing the initialization settings</param> public DefaultNetworksSettings(XElement elem) { //Validation XElement settingsElem = Validate(elem, XsdTypeName); //Parsing XElement classificationNetworksSettingsElem = settingsElem.Elements("classification").FirstOrDefault(); ClassificationNetworksCfg = classificationNetworksSettingsElem == null ? new ClassificationNetworksSettings() : new ClassificationNetworksSettings(classificationNetworksSettingsElem); XElement forecastNetworksSettingsElem = settingsElem.Elements("forecast").FirstOrDefault(); ForecastNetworksCfg = forecastNetworksSettingsElem == null ? new ForecastNetworksSettings() : new ForecastNetworksSettings(forecastNetworksSettingsElem); return; }