Exemple #1
0
        public static List <int> PrintNode(TreeNode root)
        {
            if (root.attribute.AttributeName != -1)
            {
                data.Add(root.attribute.AttributeName);
            }
            else if ((bool)root.attribute.LabelName == true)
            {
                data.Add(1);
            }
            else
            {
                data.Add(0);
            }


            if (root.attribute.values != null)
            {
                for (int i = 0; i < root.attribute.values.Count; i++)
                {
                    TreeNode childNode = root.getChildByBranchName(root.attribute.values[i]);
                    PrintNode(childNode);
                }
            }
            return(data);
        }
Exemple #2
0
 private void PrintNode(DM.DecisionTree.TreeNode test_tree, List <IndexVertex> vertex, int index)
 {
     if (test_tree.attribute.values != null)
     {
         for (int i = 0; i < test_tree.attribute.values.Count; i++)
         {
             TreeNode childNode = test_tree.getChildByBranchName(test_tree.attribute.values[i]);
             vertex.Add(new IndexVertex(childNode.attributeName + "\n" + childNode.Positive + "|" + childNode.Negative, index, test_tree.attribute.values[i], Brushes.DarkGreen));
             int number = vertex.Count;
             PrintNode(childNode, vertex, number - 1);
         }
     }
 }
Exemple #3
0
 private void PrintNode_group(DM.DecisionTree.TreeNode test_tree, List <IndexVertex> vertex, int index, string groupParamName)
 {
     if (test_tree.attribute.values != null)
     {
         for (int i = 0; i < test_tree.attribute.values.Count; i++)
         {
             TreeNode childNode = test_tree.getChildByBranchName(test_tree.attribute.values[i]);
             if (childNode.attributeName != groupParamName)
             {
                 vertex.Add(new IndexVertex(XMLWork.FindNameWithScada(test_tree.attributeName, language) + "\n" + childNode.Positive + "|" + childNode.Negative, index, test_tree.attribute.values[i], Brushes.DarkOrange));
                 int number = vertex.Count;
                 PrintNode_group(childNode, vertex, number - 1, groupParamName);
             }
         }
     }
 }
Exemple #4
0
 public void NewTree(TreeNode root, OneRow item, Dictionary <string, Tuple <decimal, decimal> > l)
 {
     if (root.attribute.values != null)
     {
         for (int i = 0; i < root.attribute.values.Count; i++)
         {
             if ((root.attribute.values[i].Item1 <= item.Input[root.attribute.AttributeName]) && ((root.attribute.values[i].Item2) >= item.Input[root.attribute.AttributeName]))
             {
                 var borderValues = new Tuple <decimal, decimal>(root.attribute.values[i].Item1, root.attribute.values[i].Item2);
                 l.Add(root.attributeName, borderValues);
                 TreeNode childNode = root.getChildByBranchName(root.attribute.values[i]);
                 NewTree(childNode, item, l);
             }
         }
     }
 }
Exemple #5
0
 public void Tree(TreeNode root, OneRow item, ref int positive)
 {
     if (root.attribute.values != null)
     {
         for (int i = 0; i < root.attribute.values.Count; i++)
         {
             if ((root.attribute.values[i].Item1 <= item.Input[root.attribute.AttributeName]) && ((root.attribute.values[i].Item2) >= item.Input[root.attribute.AttributeName]))
             {
                 TreeNode childNode = root.getChildByBranchName(root.attribute.values[i]);
                 Tree(childNode, item, ref positive);
             }
         }
     }
     else if (root.attribute.values == null)
     {
         if ((bool)root.attribute.LabelName == item.OutputBool[0])
         {
             positive = positive + 1;
         }
     }
 }
Exemple #6
0
 public void TreeWithAddParameter(TreeNode root, OneRow item, List <string> parameters)
 {
     try
     {
         if (root.attribute.values != null)
         {
             for (int i = 0; i < root.attribute.values.Count; i++)
             {
                 if ((root.attribute.values[i].Item1 <= item.Input[root.attribute.AttributeName]) &&
                     ((root.attribute.values[i].Item2) >= item.Input[root.attribute.AttributeName]))
                 {
                     parameters.Add(root.attributeName);
                     TreeNode childNode = root.getChildByBranchName(root.attribute.values[i]);
                     TreeWithAddParameter(childNode, item, parameters);
                 }
             }
         }
     }
     catch
     {
         // ignored
     }
 }