Exemple #1
0
 //Constructors
 /// <summary>
 /// Creates an initialized instance.
 /// </summary>
 /// <param name="taskDefaultsCfg">The default configurations of the readout unit tasks.</param>
 /// <param name="readoutUnitsCfg">The configuration of the readout units.</param>
 /// <param name="oneTakesAllGroupsCfg">The configuration of the "One Takes All" groups.</param>
 public ReadoutLayerSettings(TaskDefaultsSettings taskDefaultsCfg,
                             ReadoutUnitsSettings readoutUnitsCfg,
                             OneTakesAllGroupsSettings oneTakesAllGroupsCfg = null
                             )
 {
     TaskDefaultsCfg      = (TaskDefaultsSettings)taskDefaultsCfg.DeepClone();
     ReadoutUnitsCfg      = (ReadoutUnitsSettings)readoutUnitsCfg.DeepClone();
     OneTakesAllGroupsCfg = (OneTakesAllGroupsSettings)oneTakesAllGroupsCfg?.DeepClone();
     Check();
     return;
 }
Exemple #2
0
        /// <summary>
        /// Creates an initialized instance.
        /// </summary>
        /// <param name="elem">A xml element containing the configuration data.</param>
        public ReadoutLayerSettings(XElement elem)
        {
            //Validation
            XElement settingsElem = Validate(elem, XsdTypeName);

            //Parsing
            //Cluster
            TaskDefaultsCfg = new TaskDefaultsSettings(settingsElem.Element("taskDefaults"));
            //Readout units
            XElement readoutUnitsElem = settingsElem.Elements("readoutUnits").First();

            ReadoutUnitsCfg = new ReadoutUnitsSettings(readoutUnitsElem);
            //One-takes-all groups
            XElement oneTakesAllGroupsElem = settingsElem.Elements("oneTakesAllGroups").FirstOrDefault();

            OneTakesAllGroupsCfg = oneTakesAllGroupsElem == null ? null : new OneTakesAllGroupsSettings(oneTakesAllGroupsElem);
            Check();
            return;
        }
Exemple #3
0
        /// <summary>
        /// Creates an initialized instance.
        /// This is the preferred way to instantiate ReadoutLayer settings.
        /// </summary>
        /// <param name="elem">Xml element containing the initialization settings</param>
        public ReadoutLayerSettings(XElement elem)
        {
            //Validation
            XElement readoutLayerSettingsElem = Validate(elem, XsdTypeName);

            //Parsing
            TestDataRatio = double.Parse(readoutLayerSettingsElem.Attribute("testDataRatio").Value, CultureInfo.InvariantCulture);
            Folds         = readoutLayerSettingsElem.Attribute("folds").Value == DefaultFoldsString ? DefaultFoldsNum : int.Parse(readoutLayerSettingsElem.Attribute("folds").Value, CultureInfo.InvariantCulture);
            Repetitions   = int.Parse(readoutLayerSettingsElem.Attribute("repetitions").Value, CultureInfo.InvariantCulture);
            //Default networks settings
            XElement defaultNetworksElem = readoutLayerSettingsElem.Elements("defaultNetworks").FirstOrDefault();

            DefaultNetworksCfg = defaultNetworksElem == null ? new DefaultNetworksSettings() : new DefaultNetworksSettings(defaultNetworksElem);
            //Readout units
            XElement readoutUnitsElem = readoutLayerSettingsElem.Elements("readoutUnits").First();

            ReadoutUnitsCfg = new ReadoutUnitsSettings(readoutUnitsElem);
            Check();
            return;
        }
Exemple #4
0
 //Constructors
 /// <summary>
 /// Creates an initialized instance.
 /// </summary>
 /// <param name="readoutUnitsCfg">Readout units settings</param>
 /// <param name="testDataRatio">Specifies how big part of available samples will be used as testing samples during the training</param>
 /// <param name="folds">The x in the x-fold cross-validation</param>
 /// <param name="repetitions">Defines how many times the generation of whole folds will be repeated</param>
 /// <param name="defaultNetworksCfg">Task dependent networks settings to be applied when specific networks for readout unit are not specified</param>
 public ReadoutLayerSettings(ReadoutUnitsSettings readoutUnitsCfg,
                             double testDataRatio,
                             int folds       = DefaultFoldsNum,
                             int repetitions = DefaultRepetitions,
                             DefaultNetworksSettings defaultNetworksCfg = null
                             )
 {
     //Default settings
     TestDataRatio   = testDataRatio;
     Folds           = folds;
     Repetitions     = repetitions;
     ReadoutUnitsCfg = (ReadoutUnitsSettings)readoutUnitsCfg.DeepClone();
     if (defaultNetworksCfg == null)
     {
         DefaultNetworksCfg = new DefaultNetworksSettings();
     }
     else
     {
         DefaultNetworksCfg = (DefaultNetworksSettings)defaultNetworksCfg.DeepClone();
     }
     Check();
     return;
 }
Exemple #5
0
 /// <summary>
 /// The deep copy constructor
 /// </summary>
 /// <param name="source">Source instance</param>
 public ReadoutUnitsSettings(ReadoutUnitsSettings source)
     : this(source.ReadoutUnitCfgCollection)
 {
     return;
 }