コード例 #1
0
ファイル: TreeService.cs プロジェクト: ashort01/DecisionTree
        public string TraverseTree(DNARecord item, Node tree)
        {
            if (tree.children.Count == 0)
            {
                return(tree.leafClass);
            }
            var attibute       = item.sequence[tree.label];
            var attributeIndex = (int)((AttributeValues.valueIndex)Enum.Parse(typeof(AttributeValues.valueIndex), attibute.ToString()));

            try
            {
                return(TraverseTree(item, tree.children[attributeIndex]));
            }
            catch (System.ArgumentOutOfRangeException e)
            {
                return("Could not classify");
            }
        }
コード例 #2
0
ファイル: TreeService.cs プロジェクト: ashort01/DecisionTree
 public bool IsCorrectClassification(DNARecord item, string prediction)
 {
     return(item.classifier == prediction);
 }