Ejemplo n.º 1
0
        /// <summary>
        /// Load tree model from xmlnode
        /// </summary>
        /// <param name="node"></param>
        /// <returns></returns>
        public static RuleSetModel loadFromXmlNode(XmlNode node)
        {
            string functionName = null;

            if (node.Attributes["functionName"] != null)
            {
                functionName = node.Attributes["functionName"].Value;
            }

            RuleSetModel model = new RuleSetModel(MiningFunctionFromString(functionName));

            model.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.ToLowerInvariant()))
                {
                    // TODO : implement extension
                    //root.Nodes.Add(Node.loadFromXmlNode(item));
                }
                else if ("MiningSchema".Equals(item.Name))
                {
                    model.MiningSchema = MiningSchema.loadFromXmlNode(item);
                }
                else if ("RuleSet".Equals(item.Name))
                {
                    model.RuleSet = RuleSet.loadFromXmlNode(item);
                }
                else
                {
                    throw new NotImplementedException();
                }
            }

            return(model);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Load tree model from xmlnode
        /// </summary>
        /// <param name="node"></param>
        /// <returns></returns>
        public static TreeModel loadFromXmlNode(XmlNode node)
        {
            string functionName = null;

            if (node.Attributes["functionName"] != null)
            {
                functionName = node.Attributes["functionName"].Value;
            }

            TreeModel tree = new TreeModel(MiningFunctionFromString(functionName));

            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 ("Node".Equals(item.Name))
                {
                    tree.Node = Node.loadFromXmlNode(item);
                }
                else if ("MiningSchema".Equals(item.Name))
                {
                    tree.MiningSchema = MiningSchema.loadFromXmlNode(item);
                }
            }

            return(tree);
        }