Weka software decision tree - weka

After installing Weka 3.8, load a .csv file in the Explorer, I wanted to build a decision tree with the parameter "use training set".
Everything was installed ok (a self-extracting executable for 64-bit Windows that includes Oracle's 64-bit Java VM 1.8)
The file loaded fine as it was saved previously, using excel, as coma delimited.
The problem lays in building the decision tree itself: I go to the tab Classify, select the test option "use training set" and start.
After starting, appears a particular result which, accordingly to some images I've seen before, should allow, from there, to right-click and select "Visualize Tree".
That doesn't happen, as you can see in the next image:
How do I fix this in order to build the decision tree?

You have run a ZeroR classifier, see http://chem-eng.utoronto.ca/~datamining/dmc/zeror.htm. The ZeroR classifier is not a decission tree classifier and can not be visualised as such. You need to train an actual decission tree classifier, J48 is one of them. See http://facweb.cs.depaul.edu/mobasher/classes/ect584/WEKA/classify.html for a guide on how to do so.

Related

Weka libsvm is not in classpath after system format

While using weka SVM ,the error is receiving "libsvm is not in classpath'.
I set the classpath through environmental variables, But the error still remains.I was using the weka svm for one year for data classification, but I haven't gone through this kind of problem. This problem surfaced when I have installed weka 3.6.12 after formatting my system. I am using window 7 32-bit PC. The error "jdbc.idbDriver is not in path" is also exists.
Open SimpleCLI in your weka GUI and execute following commands.
java weka.core.SystemInfo
Please look for following values
java.class.path: ./weka.jar;
...
weka.version: 3.6.13
As you can see, I do not have libsvm.jar in my classpath too.
I have to include using one of the ways explained in http://weka.wikispaces.com/LibSVM.
Below passage is taken from (http://weka.wikispaces.com/LibSVM Troubleshooting)
Troubleshooting
libsvm classes not in CLASSPATH!◦Check whether the libsvm.jar is really in your CLASSPATH. Execute the following command in the SimpleCLI:
java weka.core.SystemInfo
The property java.class.path must list the libsvm.jar. If it is listed, check whether the path is correct.
If you're on Windows and you find %CLASSPATH% there, see next bullet point to fix this.
On Windows, if you added the libsvm.jar to your CLASSPATH environment variable, it can still happen that Weka pops up the error message that the libsvm classes are not in your CLASSPATH. This can happen on Windows 2000 and XP and the %CLASSPATH% does not get expanded to its actual value in starting up Weka. You can inspect your current CLASSPATH with which Weka got started up with the SimpleCLI (see previous bullet point). If %CLASSPATH% is listed there, your system has the same problem. This Wekalist post explains how to explicitly add the mysql.jar to RunWeka.ini (works the same for libsvm.jar).
Note: backslashes have to be escaped, not only once, but twice (they get interpreted by Java twice!). In other words, instead of one you have to use four: C:\some\where then turns into C:\\some\\where.
Write a startscript that sets up everything for you.
The file could be called weka.bat und should look like this (untested- adapt as necessary):
WEKA_HOME=c:\weka
set WEKA_JAR=%WEKA_HOME%\weka.jar
set PATH=$WEKA_HOME;$PATH
set CP="%WEKA_JAR%;%WEKA_HOME%\lib\libsvm.jar"
set DIR=c:\weka\data
cd "%DIR%"
set WEKA_HOME=%DIR%
rem start small GUI Chooser
java -cp $CP weka.gui.GUIChooser 2 >>c:\weka\weka.log
This assumes that you installed weka to a dir called c:\weka,
that the subdirectories \data and \lib exist, and that you have copied libsvm.jar into the \lib subdirectory.

Doxygen, nothing shows up in Graphical Class Hierarchy

I'm trying to use DOxygen to generate documentation for a rather large code base.
I got Doxygen 1.8.10 for Windows with Doxywizard.
I installed Graphviz 2.38
I was able to generate the Textual Class Hierarchy without a problem using Recursive option in the Expert tab.
I selected the "Use dot tool from GraphViz package" option in the Wizard.
I also checked "HAVE_DOT" and "CLASS_DIAGRAMS" options in the Expert tab for Dot.
When I generate the documentation and click on Show HTML Output, I cannot see anything under the Graphical Class Hierarchy. I can still see all the classes and their dependencies in the Textual Class Hierarchy.
in Mozilla Firefox, the Graphical Class Hierarchy page shows up as empty
in Internet Explorer, the Graphical Class Hierarchy page shows a lot of broken image icons aligned in 1 column
What am I doing wrong here?
Thank you,
When you select HAVE_DOT in the Expert Tab, doxygen will assume you have DOT available from the PATH. You need to make sure of this.
However, you also have the DOT_PATH option. Here you can put the path where DOT can be found.
I was able to solve this issue by executing a simple line on CMD which iteratively generates the missing .png files from .dot files.
for %f in (*dot) do dot %~nxf -Tpng -o %~nf.png
Make sure to execute this in /html folder where all .dot files reside and have dot.exe in your PATH environment variable. Also, If you receive any syntax errors, such as:
syntax error in line 1 near 'ëPNG'
try changing the default program of .dot format to Notepad (mine was set to Word).

Weka ,Text Classification on an arff file

.This is a basic question .I am trying to classify text files into 20 different classes.
Therefore I have a project structure with a folder called train,test.
In the train folder I have 20 different folders ,each folder again has many files related to that particular class.ex:weather, atheism...etc
I have now created a train.arff file for the entire train folder.When the data is visualized through I can see only two attributes .
Have provided a link below:
Screen in weka
My Doubt is how can i view the various files under these folders and remove the stopwords,punctuation,stemmin.How do I go about preprocessing.If some links to good resources are available please suggest and provide the necessary links
I found the videos below quite helpful when I first got my hands on text classification using Weka. You might want to take a look.
Weka Tutorial 31: Document Classification 1 (Application)
Weka Tutorial 32: Document classification 2 (Application)
WEKA Text Classification for First Time & Beginner Users
You might want to use StringToWordVector filter to see the effect of each word as an attribute, which is indeed described in detail in the first and last video . Within the filter settings you can give a stopwords list and choose in each run to use it or not. Same with the stemming you can change it as well. This documentation and videos will get you to understand it easily.

how to add a new weka classification algorithm to weka

I want to use some classification algorithm by weka(like c4.5, ID3) but I dont know how to add them to weka! Are they available on weka? and if these algorithm are not available how can I add them? And I could not find weka.classifiers.trees
package on google
Weka's implementation of C4.5 (and its precursor ID3) is called J48. J is for Java (and 48 is for 1998, or it is just some increment, I don't know).
Choose Weka Explorer, "Classify", "Classifier", "Tree" , "J48"
Click "More" Button:
NAME weka.classifiers.trees.J48
SYNOPSIS Class for generating a pruned or unpruned C4.5 decision tree.
For more information, see
Ross Quinlan (1993). C4.5: Programs for Machine Learning. Morgan
Kaufmann Publishers, San Mateo, CA.
Yes, they are available in weka,
As knb mentioned, we talk about J48 as if it’s synonymous with C4.5 and you dont need to download it.
In order to use ID3 classification algorithm you should download a package named "simpleEducationalLearningSchemes".
for the full process to:
Weka 3.8 Package installation: What are the steps to add id3?
(There's an answer there written by G5W)

How can I get the path followed in J48 decision tree for an instance?

I would like to know which path in the DT is followed to classify a certain instance. Is there a way to do that (of course without finding it manually in printed or visualized tree)? I am using the java API.
Also what is the best way to visualize a tree?
Thanks!
try JMP from SAS Institute (jmp.com); you can download a trial copy and build the tree for yourself; visualize the paths and also control the branches of the tree; different set breakpoints, etc..