Hitachi Vantara Pentaho Community Forums
Results 1 to 13 of 13

Thread: Decision tree in Weka

  1. #1
    Join Date
    Jul 2009
    Posts
    7

    Exclamation Decision tree in Weka

    -Good evening , i have an problem with Weka about decesion tree , when this last is drawing i have a bad picture :

    the nodes dont appears clearly as you can see in the attahcment file

    -i use J48 to generate the decision tree

    -you find also in the attachement an file arff describe my data but it contain just some row not all, in the original file i has 60500 rows

    thnks to help me and soory for my english
    Attached Images Attached Images  
    Attached Files Attached Files
    Last edited by k99; 05-18-2010 at 06:58 AM.

  2. #2
    Join Date
    Aug 2006
    Posts
    1,741

    Default

    Hi,

    Yes, I see :-) Weka's built-in tree visualizer isn't very good for visualizing large tree structures. There are some layout options available by right-clicking anywhere on the canvas, but I suspect that it won't help a great deal in your case.

    There are a couple of other options. One is to use a plugin for Weka that uses the Prefuse visualization toolkit (http://prefuse.org/). You'll need to compile the plugin though. There are full instructions and a screenshot at:

    http://weka.wikispaces.com/Explorer+...zation+plugins

    The next release of the development version of Weka (3.7.2) will include a new package management system. This plugin will be made into a package that can be installed automatically via the package manager.

    A second option is to use J48's ability to export its tree in the dot graph language. This can be done from the command line using the -g option. You can then use the excellent graph visualization package from AT&T called Graphviz (http://www.graphviz.org/) to generate very attractive graphs/trees in many different formats (gif, jpeg, postscript, eps, png etc.).

    Hope this helps.

    Cheers,
    Mark.

  3. #3
    Join Date
    Jul 2009
    Posts
    7

    Default

    Hi Mark thank you very much for your answer ¶ , i'am interresting to prefuse solution , but i dont understood exactly how i can integrate it with weka if it's possible describes me steps to integrate it !¶

    ¶About my try i created an folder 'plugins' in 'C:\weka\doc\weka\gui\visualize'
    ¶after i put the class 'PrefuseTree.java' in this folder after i launched Weka and i am following the sames old steps to construct an decison tree , finally i has the same problem !!¶

    ¶i want to know the right way to print the tree using prefuse

    ¶thanks a lot

  4. #4
    Join Date
    Aug 2006
    Posts
    1,741

    Default

    You'll need to actually compile the source code:

    1) Make sure you have a Java JDK installed (not just a JRE).
    2) make a directory weka\gui\visualize\plugins somewhere
    3) Place the PrefuseTree.java source code into the directory from step 2
    4) Edit the source code and make sure it has a package statement at the top of the file: i.e. package weka.gui.visualize.plugins;
    5) Compile the code from the parent directory where you created the directory in step 2: javac -cp <path to weka.jar>;. weka\gui\visualize\plugins\PrefuseTree.java
    6) Start Weka with the new plugin class in the classpath: java -cp <path to parent directory of plugin>;<path to weka.jar> weka.gui.GUIChooser

    Cheers,
    Mark

  5. #5
    Join Date
    Jul 2009
    Posts
    7

    Default Error

    Hi Mark , previously thnks for your response , i am following your instruction step by step but i has an probleme in step 5 as u can see in this attachment picture !
    Attached Images Attached Images  

  6. #6
    Join Date
    Aug 2006
    Posts
    1,741

    Default

    Hi,

    This directory structure and source file has to exist from the directory you are compiling from:

    weka\gui\visualize\plugins\PrefuseTree.java

    Is that the case? If you go

    dir weka\gui\visualize\plugins\PrefuseTree.java

    does it give an error?

    Cheers,
    Mark.

  7. #7
    Join Date
    Jul 2009
    Posts
    7

    Default

    hii now i have not the first problem but there are much problems in the compilation of class prefusetree.java !!! the attachmenet fil appear this error

    thnks & good last of day
    Attached Images Attached Images  

  8. #8
    Join Date
    Jul 2009
    Posts
    7

    Default

    Other ask Mr Mark , if for example i has an nominal attribute but it has much values (150) , to declar it in the arrf file i must write all values:

    @attribute myattribute {v1,v2,v3....................v150}

    or there is an special key word to indicate that is an nominal attribute

    thnks
    Last edited by k99; 06-04-2010 at 05:20 AM.

  9. #9
    Join Date
    Feb 2012
    Posts
    7

    Default

    Hi,

    I'm trying to install the Prefuse plugin (and it does not work! ) and I need some help!

    In my Program Files/Weka-3-7, I created a new directory weka/gui/visualize/plugins, and I pasted the PrefuseTree.java (I checked the name of the packa geis still weka.gui.visualize.plugins)

    Now, here is the error when I compile...
    C:\Program Files\Weka-3-7>javac -cp weka.jar;. weka\gui\visualize\plugins\PrefuseTree.java
    javac: no source files
    Usage: javac <options> <sources files>
    use -help for a list of possible options (by the way, when I try -help, it says that it is not recognized as an internal command...)

    (I directly use Weka in a java project, maybe is there a simpler solution?)

    Thanks,

    EDIT : I tried -classpath instead of -cp... Now I have 100 errors, all like this :
    symbol: class ColorAction
    location: class TreePanel
    weka\gui\visualize\plugins\PrefuseTree.java:318: error: cannot find symbol
    public int getColor(VisualItem item) {
    Last edited by actregouet; 03-05-2012 at 11:33 AM.

  10. #10
    Join Date
    Aug 2006
    Posts
    1,741

    Default

    Hi,

    Forget about compiling the code. Just upgrade to Weka 3.7.5 and install the "prefuseTree" package from the package manager (GUIChooser-->Tools menu).

    Cheers,
    Mark.

  11. #11
    Join Date
    Feb 2012
    Posts
    7

    Default

    When I do this, I have this error :

    There was a problem establishing the package meta data cache. We'll try to use the repository directory.

    I saw that the error occurred for some people, and it might be the URL which is not the right one. How can I do to change it (is there a command line to do, or a file to modify? I did not quite understand)
    Cheers,

  12. #12
    Join Date
    Aug 2006
    Posts
    1,741

    Default

    It seems that Sourceforge (where the package meta data is hosted) has changed some settings regarding how many requests a client can make in a short period of time. The cache refresh mechanism now exceeds this and I've implemented a new one that is faster and doesn't cause a problem with this regards. Until a new release of Weka you can tell Weka to use a mirror of the meta data, as described in this mailing list post:

    https://list.scms.waikato.ac.nz/mail...ry/054741.html

    or download a nightly snapshot of the developer version of Weka that has the new cache refresh mechanism implemented:

    http://www.cs.waikato.ac.nz/ml/weka/snapshots/

    Cheers,
    Mark.

  13. #13
    Join Date
    Feb 2012
    Posts
    7

    Default

    Explanations are not very clear for me (and I'm not very good at this)... I tried both, and did not success
    - the comand line returns that weka.core... cannot be found
    - I downloaded one of the snapshots... and then what?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.