Before we start

For this task, we will need an additional Weka package, ensembleLibrary. Weka 3.7.2 and higher versions support external packages, mainly developed by the academic community. A list of WEKA Packages is available at http://weka.sourceforge.net/packageMetaData, as shown in the following screenshot:

Find and download the latest available version of the ensembleLibrary package at http://prdownloads.sourceforge.net/weka/ensembleLibrary1.0.5.zip?download.

After you unzip the package, locate ensembleLibrary.jar and import it into your code, as follows:

import weka.classifiers.meta.EnsembleSelection; 

Get Machine Learning in Java - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.