Introduction & WEKA Setup

Previous Page Home Next Page

This is an introductory section which goes through the required steps to set up WEKA, WekaDeeplearning4j, and the GPU accelerated libraries (if your machine supports it).

At the end of this page are some short tips & tricks to make using WEKA even easier.

Not Included in This Tutorial

WekaDeeplearning4j has a lot of features relating to deep-learning, but due to the limited scope of the tutorial, some of these were left out; this tutorial focuses solely on CNN-related techniques for image classification datasets. The following links may help you for other domains:

Prerequisites

Environment Variables

The command-line examples in this tutorial assume a few environment variables are set. You can ignore these if you only wish to use the GUI.

Installing WekaDeeplearning4j

The final required step is to install the WekaDeeplearning4j package from the WEKA Package Manager.

Package Manager

The package can also be installed via the command-line by downloading the most recent package zip, then running:

$ java weka.core.WekaPackageManager -install-package <PACKAGE-ZIP>

You can check whether the installation was successful with

$ java weka.core.WekaPackageManager -list-packages installed

which results in

Installed	Repository	Loaded	Package
=========	==========	======	=======
1.7.0    	1.7.0     	Yes	    wekaDeeplearning4j: Weka wrappers for Deeplearning4j

Add GPU Support

The GPU additions needs CUDA Toolkit (10.0, 10.1, or 10.2) and corresponding appropriate cuDNN library to be installed on your machine. Unfortunately, CUDA is the only way to use GPU acceleration with WekaDeeplearning4j and most Mac computers use AMD graphics cards; because of this, only Linux and Windows machines can use GPU acceleration. If you’re using a Mac with an external Nvidia GPU then you may be able to add GPU support for WekaDeeplearning4j, but this is experimental. For valid operating systems, Nvidia provides some good installation instructions:

CUDA Toolkit

CUDNN

WekaDeeplearning4j GPU libraries

After setting up CUDA correctly on your machine, you’ll need to install the WekaDeeplearning4j CUDA/cuDNN libraries. Download and run the latest install-cuda-libs.sh for Linux or install-cuda-libs.ps1 for Windows.

The install script automatically downloads the libraries and copies them into your wekaDeeplearning4j package installation. If you want to download the library zip yourself, choose the appropriate combination of your platform and CUDA version from the latest release and point the installation script to the file, e.g.:

./install-cuda-libs.sh ~/Downloads/wekaDeeplearning4j-cuda-10.2-1.7.0-linux-x86_64.zip

General Tips

Running WEKA from the Command Line

A common workflow is to experiment with different models/hyperparameters in the WEKA Explorer on a small subset of the data, then run the final configuration with the full dataset on a more powerful headless server. Figuring out the correct command-line syntax on the server directly can be difficult, especially for complex models, so WEKA has a Copy configuration to clipboard function.

  1. Set up your configuration in the WEKA Explorer window (e.g., on your local machine), then right click and click Copy configuration to clipboard:

    Copy configuration to clipboard example

  2. Paste this into the command line (e.g., on your association’s machine learning servers), specifying any other flags necessary for weka.Run that aren’t included in the pasted configuration. For example training a Dl4jMlpClassifier can be done like:

     $ java weka.Run <Dl4jMlpClassifier configuration from clipboard> \
         -t <.arff file previously loaded into Weka> \
         -d <output model file path> \
         -split-percentage 80
    
Previous Page Home Next Page