Exemplo n.º 1
0
        /// <summary>
        /// 获得测试结果
        /// </summary>
        /// <returns></returns>
        public string getTestResult()
        {
            TreeController Tree = new TreeController();

            string name      = rootNode.Name;
            string condition = getCondition(name);

            int index = data.getAttributeByName(name, condition);

            while (condition.CompareTo("00") != 0)
            {
                if (index == 0)
                {
                    name = Tree.FindNode(rootNode.FirstNode, condition).Name;
                }
                else if (index == 1)
                {
                    name = Tree.FindNode(rootNode.FirstNode.NextNode, condition).Name;
                }
                else if (index == 2)
                {
                    name = Tree.FindNode(rootNode.FirstNode.NextNode.NextNode, condition).Name;
                }
                else
                {
                    name = Tree.FindNode(rootNode.FirstNode.NextNode.NextNode.NextNode, condition).Name;
                }

                condition = getCondition(name);
            }
            return(name);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 决策树可视化
        /// </summary>
        private void createTreeView()
        {
            DataMode       data = new DataMode();
            TreeController Tree = new TreeController();
            ID3_Algorithm  id   = new ID3_Algorithm();

            Tree.initialFlash();
            Tree.initialisBuild();

            string[,] dataArray = data.getData();
            rootName            = Tree.getTreeNodeName(0);

            rootNode.Text = rootName;
            rootNode.Name = rootName;
            rootNode.Tag  = rootName;
            DecisiontreeView.Nodes.Add(rootNode);
            Tree.createChild(rootNode, rootName);
            temp.Name = rootNode.LastNode.Name;
            temp.Text = rootNode.LastNode.Text;
            temp.Tag  = rootNode.LastNode.Tag;

            Tree.createTree(temp);
            DecisiontreeView.ExpandAll();
        }