Re: Level Order Tree Traversal of C4.5 (J48) Tree

[email protected]
Newsgroups gmane.comp.ai.weka
Message-ID <162496216725.9590.5403507575936951134@sys-mailman-prd.its.waikato.ac.nz>
Dear Professor Eibe Frank,

I have included the newline at the appropriate position. I include the code for
convenience:

  public static String breadthFirst(ClassifierTree tree) throws Exception{
    StringBuffer buffer = new StringBuffer();
    Queue<ClassifierTree> fifoQueue = new LinkedList<>();
    fifoQueue.add(tree);
    while (!fifoQueue.isEmpty()) {
      ClassifierTree firstElement = fifoQueue.peek();
      fifoQueue.remove();
      if (!firstElement.isLeaf()) {
        for (int i = 0; i < firstElement.m_sons.length; i++) {
          buffer.append(firstElement.m_localModel.leftSide(firstElement.m_train)
                  + firstElement.m_localModel.rightSide(i, firstElement.m_train) + "\n");
          ClassifierTree currentSuccessor = firstElement.m_sons[i];
          fifoQueue.add(currentSuccessor);
        }
        buffer.append("\n");
      } else {
        buffer.append(": " + firstElement.m_localModel.dumpLabel(0,
                firstElement.m_train) + "\n");
      }
    }
    return buffer.toString();
  }

Your help is very valuable!

Thank you again!

Spyros Halkidis
_______________________________________________
Wekalist mailing list -- [email protected]
Send posts to [email protected]
To unsubscribe send an email to [email protected]
To subscribe, unsubscribe, etc., visit https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.