Exemplo n.º 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);
        }
Exemplo n.º 2
0
        public override object Load(XmlNode node)
        {
            var result = (Adam)Activator.CreateInstance(Type);

            result.Alpha = XmlStorage.GetDoubleValue(node, "Alpha");
            result.Beta1 = XmlStorage.GetDoubleValue(node, "Beta1");
            result.Beta2 = XmlStorage.GetDoubleValue(node, "Beta2");
            return(result);
        }
Exemplo n.º 3
0
        public override object Load(XmlNode node)
        {
            if (node == null)
            {
                return(null);
            }

            var mean  = XmlStorage.GetDoubleValue(node, "Mean");
            var delta = XmlStorage.GetDoubleValue(node, "Delta");

            return(Activator.CreateInstance(Type, mean, delta));
        }
Exemplo n.º 4
0
        public override object Load(XmlNode node)
        {
            var learningRate = XmlStorage.GetDoubleValue(node, "LearningRate");

            return(Activator.CreateInstance(Type, learningRate));
        }
Exemplo n.º 5
0
        public override object Load(XmlNode node)
        {
            var strength = XmlStorage.GetDoubleValue(node, "Strength");

            return(Activator.CreateInstance(Type, strength));
        }