Configuring Weka in Eclipse, and adding algorithms

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.