コード例 #1
0
ファイル: ReadoutLayer.cs プロジェクト: okozelsk/NET
 /// <summary>
 /// Resets the readout layer to its initial untrained state.
 /// </summary>
 public void Reset()
 {
     _predictorFeatureFilterCollection = null;
     _outputFeatureFilterCollection    = null;
     _predictorsMapper      = null;
     _readoutUnitCollection = new ReadoutUnit[ReadoutLayerCfg.ReadoutUnitsCfg.ReadoutUnitCfgCollection.Count];
     for (int i = 0; i < ReadoutLayerCfg.ReadoutUnitsCfg.ReadoutUnitCfgCollection.Count; i++)
     {
         ReadoutUnitSettings cfg = ReadoutLayerCfg.ReadoutUnitsCfg.ReadoutUnitCfgCollection[i];
         _readoutUnitCollection[i] = new ReadoutUnit(i, cfg, ReadoutLayerCfg.TaskDefaultsCfg);
     }
     _oneTakesAllGroupCollection = null;
     if (ReadoutLayerCfg.OneTakesAllGroupsCfg != null)
     {
         _oneTakesAllGroupCollection = new OneTakesAllGroup[ReadoutLayerCfg.OneTakesAllGroupsCfg.OneTakesAllGroupCfgCollection.Count];
         for (int i = 0; i < ReadoutLayerCfg.OneTakesAllGroupsCfg.OneTakesAllGroupCfgCollection.Count; i++)
         {
             OneTakesAllGroupSettings cfg = ReadoutLayerCfg.OneTakesAllGroupsCfg.OneTakesAllGroupCfgCollection[i];
             _oneTakesAllGroupCollection[i] = new OneTakesAllGroup(i, cfg, ReadoutLayerCfg.GetOneTakesAllGroupMemberRUnitIndexes(cfg.Name));
         }
     }
     Trained = false;
     ResetProgressTracking();
     return;
 }
コード例 #2
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)
        {
            XElement rootElem = new XElement(rootElemName);

            if (!suppressDefaults || !IsDefaultRandomizerSeek)
            {
                rootElem.Add(new XAttribute("randomizerSeek", RandomizerSeek.ToString(CultureInfo.InvariantCulture)));
            }
            if (NeuralPreprocessorCfg != null)
            {
                rootElem.Add(NeuralPreprocessorCfg.GetXml(suppressDefaults));
            }
            rootElem.Add(ReadoutLayerCfg.GetXml(suppressDefaults));
            if (MapperCfg != null)
            {
                rootElem.Add(MapperCfg.GetXml(suppressDefaults));
            }
            Validate(rootElem, XsdTypeName);
            return(rootElem);
        }