AIMA.Core.Learning.Inductive.DecisionTree.ToString C# (CSharp) Method

ToString() public method

public ToString ( ) : String
return String
        public override String ToString()
        {
            return ToString(1, new StringBuilder());
        }

Same methods

DecisionTree::ToString ( int depth, StringBuilder buf ) : String

Usage Example

Example #1
0
        public virtual String ToString(int depth, StringBuilder buf)
        {
            if (attributeName != null)
            {
                buf.Append(Util.ntimes("\t", depth));
                buf.Append(Util.ntimes("***", 1));
                buf.Append(attributeName + " \n");
                foreach (String attributeValue in nodes.Keys)
                {
                    buf.Append(Util.ntimes("\t", depth + 1));
                    buf.Append("+" + attributeValue);
                    buf.Append("\n");
                    DecisionTree child = nodes[attributeValue];
                    buf.Append(child.ToString(depth + 1, new StringBuilder()));
                }
            }

            return(buf.ToString());
        }