コード例 #1
0
ファイル: Pmml.cs プロジェクト: wearefullstack/pmml4net
        /// <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);
        }
コード例 #2
0
ファイル: Pmml.cs プロジェクト: mindis/pmml4net
        /// <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;
        }