Configuring Weka in Eclipse
1 Find Weka Installation location, look for Weka compressed file Weka-src.jar, unzip the compressed file, extract the folder Weka-src.
2 Open Eclipse, New Java Project Project Weka.
3 Select Package src, right click on Import, select General, select File System, select the path where the program (Weka-src\src\main\java) is located, and then tick before Java and click Done.
4 There are many errors at this time because of the lack of Java-cup.jar, select the right click on the project Weka, select Properties, then select the Java build path, and then select Add external jars on the right, follow the path to find weka-src\lib\ Java-cup.jar, click on the package and click OK.
5 Program Test Run, Run Naivebayessimple (in the package weka.classifiers.bayes), a lot of errors, and then right-click to select the Run configuration, select the arguments in the right box (Arguments), it is recommended to copy the folder data in the Weka installation directory to the project directory, and then add variables, For example:-t C:\Users\Administrator\workspace\weka\data\weather.arff, click Apply, and then run again.
Add your own algorithm in the Weka
Then the environment configured above
1 Create a new package in the project Weka, such as creating a package called "Weka.classifiers.myalgorithm".
2 Write your own code in the "Weka.classifiers.myalgorithm" package, here for convenience, I add the Java file directly under the "Weka.classifiers.trees" package to copy the ID3 algorithm to " Weka.classifiers.myalgorithm "in the package. and change the name to" MyId3. "
3 Modify the project under the "Weka\src\weka.gui" package under the two two profiles "Genericpropertiescreator.props" and "Genericobjecteditor.props"
4 in the file "Genericpropertiescreator.props" find "# Lists the classifiers-packages I want to choose from" this one, and then in the " Weka.classifiers.rules "The previous line adds" Weka.classifiers.myalgorithm,\ "last Save settings.
5 Find "# Lists the classifiers I want to choose from" in the file "Genericobjecteditor.props" and then in "Weka.classifiers.rules.ZeroR" The previous line added "Weka.classifiers.myalgorithm.myid3,\" last Save settings.
6 Select Project Weka, right-click Run, then select Main-weka.gui, then OK, the Weka interface will appear.
Configuring Weka in Eclipse, and adding algorithms