private List<LearningSetup> LearningSetup_Load(string fileName) { List<LearningSetup> learningSetupList = new List<LearningSetup>(); XmlDocument xmlDocument = new XmlDocument(); xmlDocument.Load(fileName); XmlNodeList processSetupNodeList = xmlDocument.SelectNodes("/Root/ProcessSetupList/ProcessSetup"); foreach (XmlNode processSetupNode in processSetupNodeList) { LearningSetup loadProcessSetup = new LearningSetup(); XmlNode trainingInformationNode = processSetupNode.SelectSingleNode("TrainingInformation"); loadProcessSetup.TrainingEpoch = int.Parse(trainingInformationNode.Attributes["Epoch"].Value); loadProcessSetup.MatrixCalculationSize = int.Parse(trainingInformationNode.Attributes["MatrixCalculationSize"].Value); switch (trainingInformationNode.Attributes["Mode"].Value) { case "RandomAll": loadProcessSetup.TrainingProcessMode = ProcessMode.RandomAll; break; case "RandomInStimuliPack": loadProcessSetup.TrainingProcessMode = ProcessMode.RandomInStimuliPack; break; case "SequentialAll": loadProcessSetup.TrainingProcessMode = ProcessMode.SequentialAll; break; case "SequentialinStimuliPack": loadProcessSetup.TrainingProcessMode = ProcessMode.SequentialinStimuliPack; break; } foreach (XmlNode matchingInformationNode in trainingInformationNode.SelectNodes("MatchingInformation")) { MatchingInformation loadTrainingMatchingInformation = new MatchingInformation(); loadTrainingMatchingInformation.StimuliPackName = matchingInformationNode.Attributes["StimuliPack"].Value; loadTrainingMatchingInformation.ProcessName = matchingInformationNode.Attributes["Process"].Value; foreach (XmlNode patternSetupNode in matchingInformationNode.SelectNodes("PatternSetup")) { loadTrainingMatchingInformation.PatternSetup[int.Parse(patternSetupNode.Attributes["Order"].Value)] = patternSetupNode.Attributes["Pattern"].Value; } loadProcessSetup.TrainingMatchingInformationList.Add(loadTrainingMatchingInformation); } XmlNode testInformationNode = processSetupNode.SelectSingleNode("TestInformation"); loadProcessSetup.TestTiming = int.Parse(testInformationNode.Attributes["Timing"].Value); foreach (XmlNode matchingInformationNode in testInformationNode.SelectNodes("MatchingInformation")) { MatchingInformation loadtestMatchingInformation = new MatchingInformation(); loadtestMatchingInformation.StimuliPackName = matchingInformationNode.Attributes["StimuliPack"].Value; loadtestMatchingInformation.ProcessName = matchingInformationNode.Attributes["Process"].Value; foreach (XmlNode patternSetupNode in matchingInformationNode.SelectNodes("PatternSetup")) { loadtestMatchingInformation.PatternSetup[int.Parse(patternSetupNode.Attributes["Order"].Value)] = patternSetupNode.Attributes["Pattern"].Value; } loadProcessSetup.TestMatchingInformationList.Add(loadtestMatchingInformation); } learningSetupList.Add(loadProcessSetup); } return learningSetupList; }
private List <LearningSetup> LearningSetup_Load(string fileName) { List <LearningSetup> learningSetupList = new List <LearningSetup>(); XmlDocument xmlDocument = new XmlDocument(); xmlDocument.Load(fileName); XmlNodeList processSetupNodeList = xmlDocument.SelectNodes("/Root/ProcessSetupList/ProcessSetup"); foreach (XmlNode processSetupNode in processSetupNodeList) { LearningSetup loadProcessSetup = new LearningSetup(); XmlNode trainingInformationNode = processSetupNode.SelectSingleNode("TrainingInformation"); loadProcessSetup.TrainingEpoch = int.Parse(trainingInformationNode.Attributes["Epoch"].Value); loadProcessSetup.MatrixCalculationSize = int.Parse(trainingInformationNode.Attributes["MatrixCalculationSize"].Value); switch (trainingInformationNode.Attributes["Mode"].Value) { case "RandomAll": loadProcessSetup.TrainingProcessMode = ProcessMode.RandomAll; break; case "RandomInStimuliPack": loadProcessSetup.TrainingProcessMode = ProcessMode.RandomInStimuliPack; break; case "SequentialAll": loadProcessSetup.TrainingProcessMode = ProcessMode.SequentialAll; break; case "SequentialinStimuliPack": loadProcessSetup.TrainingProcessMode = ProcessMode.SequentialinStimuliPack; break; } foreach (XmlNode matchingInformationNode in trainingInformationNode.SelectNodes("MatchingInformation")) { MatchingInformation loadTrainingMatchingInformation = new MatchingInformation(); loadTrainingMatchingInformation.StimuliPackName = matchingInformationNode.Attributes["StimuliPack"].Value; loadTrainingMatchingInformation.ProcessName = matchingInformationNode.Attributes["Process"].Value; foreach (XmlNode patternSetupNode in matchingInformationNode.SelectNodes("PatternSetup")) { loadTrainingMatchingInformation.PatternSetup[int.Parse(patternSetupNode.Attributes["Order"].Value)] = patternSetupNode.Attributes["Pattern"].Value; } loadProcessSetup.TrainingMatchingInformationList.Add(loadTrainingMatchingInformation); } XmlNode testInformationNode = processSetupNode.SelectSingleNode("TestInformation"); loadProcessSetup.TestTiming = int.Parse(testInformationNode.Attributes["Timing"].Value); foreach (XmlNode matchingInformationNode in testInformationNode.SelectNodes("MatchingInformation")) { MatchingInformation loadtestMatchingInformation = new MatchingInformation(); loadtestMatchingInformation.StimuliPackName = matchingInformationNode.Attributes["StimuliPack"].Value; loadtestMatchingInformation.ProcessName = matchingInformationNode.Attributes["Process"].Value; foreach (XmlNode patternSetupNode in matchingInformationNode.SelectNodes("PatternSetup")) { loadtestMatchingInformation.PatternSetup[int.Parse(patternSetupNode.Attributes["Order"].Value)] = patternSetupNode.Attributes["Pattern"].Value; } loadProcessSetup.TestMatchingInformationList.Add(loadtestMatchingInformation); } learningSetupList.Add(loadProcessSetup); } return(learningSetupList); }