/// <summary> /// Load MiningModel node from XmlElement of PMML file /// </summary> /// <param name="node">Xml PMML file to read</param> /// <returns></returns> public static MiningModel loadFromXmlNode(XmlNode node) { MiningModel model = new MiningModel(); /*tree.ModelName = node.Attributes["modelName"].Value; if (node.Attributes["missingValueStrategy"] != null) tree.MissingValueStrategy = MissingValueStrategyfromString(node.Attributes["missingValueStrategy"].Value); // By default noTrueChildStrategy = returnNullPrediction tree.noTrueChildStrategy = NoTrueChildStrategy.ReturnNullPrediction; if (node.Attributes["noTrueChildStrategy"] != null) tree.noTrueChildStrategy = NoTrueChildStrategyfromString(node.Attributes["noTrueChildStrategy"].Value); */ foreach(XmlNode item in node.ChildNodes) { if ("Extension".Equals(item.Name)) { // Not yet implemented } else if ("MiningSchema".Equals(item.Name)) { //tree.Node = Node.loadFromXmlNode(item); } else if ("Segmentation".Equals(item.Name)) { model.segmentation = Segmentation.loadFromXmlNode(item); } else throw new NotImplementedException(); } return model; }
/// <summary> /// Load pmml file /// </summary> /// <param name="xml">Xml PMML file to read></param> public static Pmml loadModels(XmlDocument xml) { Pmml pmml = new Pmml(); pmml.models = new List <ModelElement>(); foreach (XmlNode root in xml.ChildNodes) { if (root is XmlElement) { foreach (XmlNode child in root.ChildNodes) { if (child.Name.Equals("DataDictionary")) { pmml.DataDictionary = DataDictionary.loadFromXmlNode(child); } else if (child.Name.Equals("RuleSetModel")) { pmml.models.Add(RuleSetModel.loadFromXmlNode(child)); } else if (child.Name.Equals("TreeModel")) { pmml.models.Add(TreeModel.loadFromXmlNode(child)); } else if (child.Name.Equals("MiningModel")) { pmml.models.Add(MiningModel.loadFromXmlNode(child)); } } } } return(pmml); }
/// <summary> /// Load MiningModel node from XmlElement of PMML file /// </summary> /// <param name="node">Xml PMML file to read</param> /// <returns></returns> public static MiningModel loadFromXmlNode(XmlNode node) { MiningModel model = new MiningModel(); /*tree.ModelName = node.Attributes["modelName"].Value; * * if (node.Attributes["missingValueStrategy"] != null) * tree.MissingValueStrategy = MissingValueStrategyfromString(node.Attributes["missingValueStrategy"].Value); * * // By default noTrueChildStrategy = returnNullPrediction * tree.noTrueChildStrategy = NoTrueChildStrategy.ReturnNullPrediction; * if (node.Attributes["noTrueChildStrategy"] != null) * tree.noTrueChildStrategy = NoTrueChildStrategyfromString(node.Attributes["noTrueChildStrategy"].Value); */ foreach (XmlNode item in node.ChildNodes) { if ("Extension".Equals(item.Name)) { // Not yet implemented } else if ("MiningSchema".Equals(item.Name)) { //tree.Node = Node.loadFromXmlNode(item); } else if ("Segmentation".Equals(item.Name)) { model.segmentation = Segmentation.loadFromXmlNode(item); } else { throw new NotImplementedException(); } } return(model); }