Install the necessary compiler, source code package, and compilation environment.
1. Configure the appropriate java version, and put the directory of the jre java command into the path environment variable. Java can be installed through apt, etc. The following methods are not necessarily suitable for you.
java version 1.6.0_18 or 1.6.0_13 (1.4.2 compiles but not) java is upgraded through the
official java website with its own upgrade package : http://www.java.com/en/download/manual.jsp http://java .sun.com/javaee/downloads/index.jsp
linux java 1.6 download address: http://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_SMI-Site/en_US/-/USD/ VerifyItem-Start/java_ee_sdk-6u1-unix.sh?BundledLineItemUUID=9bWJ_hCuwjkAAAEp.lsSMvP6&OrderID=YDOJ_hCur2MAAAEp6lsSMvP6&ProductID=uWOJ_hCy5a4AAAEpeiFudDgFudk-6
2, weka package
Weka official website: http://www.cs.waikato.ac.nz/ml/weka/ The
latest 3.7.1 weka package download address, linux version: http://prdownloads.sourceforge.net/weka/weka- 3-7-1.zip
unzip *.zip
cd weka-3-7-1
mkdir weka-src
cp weka-src.jar ./weka-src
jar zvf weka-src.jar
3. Compilation environment of weka package
Ant official website: http://ant.apache.org The
latest 1.8.1 ant package download address: http://labs.renren.com/apache-mirror/ant/binaries/apache-ant-1.8.1- bin.tar.gz
tar zxvpf *.tar.gz
libsvm official website: http://www.csie.ntu.edu.tw/~cjlin/libsvm/ the
latest 2.91 libsvm download address: http://www.csie.ntu.edu.tw/~cjlin/cgi-bin /libsvm.cgi?+http://www.csie.ntu.edu.tw/~cjlin/libsvm+tar.gz
tar zxvpf *.tar.gz
4. File layout.
The folders after decompression of the packaged files are unified under the /data/dm/ directory
To configure ant, you can use
export ANT_HOME=/data/dm/apache-ant-1.8.1
export PATH=$ANT_HOME/bin:$PATH
5. Weka's actual operation.
cd / data / dm / weka-3-7-1 / weka-src /
ant //Start to compile, the word BUILD SUCCESSFUL will appear when the compile is successful
//Here is the kernel of redhat 2.6.9, the maximum memory used by java can be adjusted, 2690M.
java -Xmx2690m -cp ./build/classes/ weka.classifiers.trees.J48 -t ./data/weather.arff -T ./data/weather.arff
//The following results will appear at this time:
J48 pruned tree
------------------
outlook = sunny
| humidity <= 75: yes (2.0)
| humidity > 75: no (3.0)
outlook = overcast: yes (4.0)
outlook = rainy
| windy = TRUE: no (2.0)
| windy = FALSE: yes (3.0)
Number of Leaves : 5
Size of the tree : 8
Time taken to build model: 0.08 seconds
Time taken to test model on training data: 0 seconds
=== Error on training data ===
Correctly Classified Instances 14 100 %
Incorrectly Classified Instances 0 0 %
Kappa statistic 1
Mean absolute error 0
Root mean squared error 0
Relative absolute error 0 %
Root relative squared error 0 %
Coverage of cases (0.95 level) 100 %
Mean rel. region size (0.95 level) 50 %
Total Number of Instances 14
=== Confusion Matrix ===
a b <-- classified as
9 0 | a = yes
0 5 | b = no
=== Error on test data ===
Correctly Classified Instances 14 100 %
Incorrectly Classified Instances 0 0 %
Kappa statistic 1
Mean absolute error 0
Root mean squared error 0
Relative absolute error 0 %
Root relative squared error 0 %
Coverage of cases (0.95 level) 100 %
Mean rel. region size (0.95 level) 50 %
Total Number of Instances 14
=== Confusion Matrix ===
a b <-- classified as
9 0 | a = yes
0 5 | b = no
//This is the first step, the establishment and operation of the weka environment, after which you need to select an algorithm and modify the code to generate an online discriminant class, which is a classification library in the traditional sense.
author:http://hi.baidu.com/jrckkyy
author:http://blog.csdn.net/jrckkyy