Пример #1
0
        public virtual string ToString(int depth, IStringBuilder buf)
        {
            if (attributeName != null)
            {
                buf.Append(Util.ntimes("\t", depth));
                buf.Append(Util.ntimes("***", 1));
                buf.Append(attributeName + " \n");
                foreach (string attributeValue in nodes.GetKeys())
                {
                    buf.Append(Util.ntimes("\t", depth + 1));
                    buf.Append("+" + attributeValue);
                    buf.Append("\n");
                    DecisionTree child = nodes.Get(attributeValue);
                    buf.Append(child.ToString(depth + 1, TextFactory.CreateStringBuilder()));
                }
            }

            return(buf.ToString());
        }
Пример #2
0
        public static ICollection <DecisionTree> getStumpsFor(DataSet ds,
                                                              string returnValueIfMatched, string returnValueIfUnmatched)
        {
            ICollection <string>       attributes = ds.getNonTargetAttributes();
            ICollection <DecisionTree> trees      = CollectionFactory.CreateQueue <DecisionTree>();

            foreach (string attribute in attributes)
            {
                ICollection <string> values = ds.getPossibleAttributeValues(attribute);
                foreach (string value in values)
                {
                    ICollection <string> unmatchedValues = Util.removeFrom(ds.getPossibleAttributeValues(attribute), value);

                    DecisionTree tree = getStumpFor(ds, attribute, value,
                                                    returnValueIfMatched, unmatchedValues,
                                                    returnValueIfUnmatched);
                    trees.Add(tree);
                }
            }
            return(trees);
        }
Пример #3
0
 public override void addNode(string attributeValue, DecisionTree tree)
 {
     throw new RuntimeException("cannot add Node to ConstantDecisonTree");
 }
Пример #4
0
 public virtual void addNode(string attributeValue, DecisionTree tree)
 {
     nodes.Put(attributeValue, tree);
 }