Esempio n. 1
0
        /// <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);
        }
Esempio n. 2
0
        /// <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;
        }