/// <summary> /// Creates an initialized instance. /// </summary> /// <param name="elem">A xml element containing the configuration data.</param> public FeedingPatternedSettings(XElement elem) { //Validation XElement settingsElem = Validate(elem, XsdTypeName); //Parsing Slices = int.Parse(settingsElem.Attribute("slices").Value, CultureInfo.InvariantCulture); Bidir = (NeuralPreprocessor.BidirProcessing)Enum.Parse(typeof(NeuralPreprocessor.BidirProcessing), settingsElem.Attribute("bidir").Value, true); VarSchema = (InputPattern.VariablesSchema)Enum.Parse(typeof(InputPattern.VariablesSchema), settingsElem.Attribute("variablesSchema").Value, true); XElement uniElem = settingsElem.Elements("unification").FirstOrDefault(); if (uniElem != null) { UnificationCfg = new UnificationSettings(uniElem); } else { UnificationCfg = new UnificationSettings(); } XElement steadyFieldsElem = settingsElem.Elements("steadyFields").FirstOrDefault(); if (steadyFieldsElem != null) { SteadyFieldsCfg = new SteadyFieldsSettings(steadyFieldsElem); } else { SteadyFieldsCfg = null; } Check(); return; }
//Constructors /// <summary> /// Creates an itialized instance. /// </summary> /// <param name="slices">Specifies how many times to collect predictors during the pattern preprocessing.</param> /// <param name="bidir">Specifies whether and how to preprocess pattern in both time directions.</param> /// <param name="varSchema">Specifies the variables organization schema in the pattern.</param> /// <param name="unificationCfg">The configuration of the pattern unification.</param> /// <param name="steadyFieldsCfg">The configuration of the steady external input fields.</param> public FeedingPatternedSettings(int slices = DefaultSlices, NeuralPreprocessor.BidirProcessing bidir = DefaultBidir, InputPattern.VariablesSchema varSchema = DefaultVarSchema, UnificationSettings unificationCfg = null, SteadyFieldsSettings steadyFieldsCfg = null ) { Slices = slices; Bidir = bidir; VarSchema = varSchema; UnificationCfg = unificationCfg == null ? new UnificationSettings() : (UnificationSettings)unificationCfg.DeepClone(); SteadyFieldsCfg = steadyFieldsCfg == null ? null : (SteadyFieldsSettings)steadyFieldsCfg.DeepClone(); Check(); return; }
/// <summary> /// The deep copy constructor /// </summary> /// <param name="source">Source instance</param> public SteadyFieldsSettings(SteadyFieldsSettings source) : this() { AddFields(source.FieldCfgCollection); return; }