Пример #1
0
        public override object Load(XmlNode node)
        {
            if (node == null)
            {
                return(null);
            }

            var model       = XmlStorage.GetObjectValue <IModel>(node, "Model");
            var batchSize   = XmlStorage.GetIntValue(node, "BatchSize");
            var epoch       = XmlStorage.GetIntValue(node, "Epoch");
            var randomBatch = bool.Parse(XmlStorage.GetStringValue(node, "RandomBatch"));
            var result      = (Trainer)Activator.CreateInstance(Type, model, batchSize, epoch, randomBatch);

            result.Mission           = XmlStorage.GetStringValue(node, "Mission");
            result.PrintSteps        = XmlStorage.GetIntValue(node, "PrintSteps");
            result.LastTrainLoss     = XmlStorage.GetDoubleValue(node, "LastTrainLoss");
            result.LastTrainAccuracy = XmlStorage.GetDoubleValue(node, "LastTrainAccuracy");
            result.LastTestLoss      = XmlStorage.GetDoubleValue(node, "LastTestLoss");
            result.LastTestAccuracy  = XmlStorage.GetDoubleValue(node, "LastTestAccuracy");
            result.PreProcessor      = XmlStorage.GetObjectValue <IPreProcessor>(node, "PreProcessor");
            result.LabelCodec        = XmlStorage.GetObjectValue <DiscreteCodec>(node, "LabelCodec");
            result.Normalizer        = XmlStorage.GetObjectValue <INormalizer>(node, "Normalizer");

            return(result);
        }