In this guide we are going to discuss how to install and use the Datumbox Machine Learning framework in your Java projects. Since almost all of the code is written in Java, using it is as simple as including it as dependency in your Java project. Nevertheless a couple of classes (DataEnvelopmentAnalysis and LPSolver) use an external C library called lpsolve (Linear Programming Solver). Note that if you don’t plan to use those 2 classes you are not required to install any binary libraries on your system. Nevertheless if you want to explore all the supported algorithms it is recommended to do the full installation as described below. This guide covers the installations on Linux and Windows systems and we provide references for installing it on Mac OSX.
Step 1: Ensure you have Maven 3 installed
Before using the framework you will need to make sure that Maven 3 is installed on your system. To validate this open up a console/terminal and type the following:
Apache Maven 3.2.1 (ea8b2b07643dbb1b84b6d16e1f08391b666bc1e9; 2014-02-14T17:37:52+00:00)
Maven home: /usr/share/maven3
Java version: 1.8.0_25, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-oracle/jre
Default locale: en_GB, platform encoding: UTF-8
OS name: "linux", version: "3.13.0-34-generic", arch: "amd64", family: "unix"
If Maven 3 is not installed on your system follow this guide. If you want to learn how Maven works check out this guide. Finally to see how to use Maven in your favourite IDE checkout the following Eclipse and Netbeans tutorials.
Step 2 (Optional): Installing Lpsolve 188.8.131.52
The framework uses lpsolve 184.108.40.206 to solve linear programming problems. Note that it is very important to install the correct version of the library to avoid problems. Thus don’t use the package manager of your operating system because in general you will not find the latest versions.
To use the library you need to install 2 binary files: the liblpsolve55 dev library which solves linear programs and the liblpsolve55j which is a Java wrapper. Even though you can download the files from the official website and follow their installation guide, in this tutorial we try to keep things as simple as possible and provide our own installation guide.
The first thing you will need to do is go to our Github LpSolve repository and download the project. Once you unzip it, go to the lib folder. There you will find 5 subfolders that contain the binary libraries for the most popular operating systems in 32bit and 64bit flavours. If you work on Windows click on win32 or win64 folders, if you are on Unix/Linux click on the ux32 or ux64 folder, while if you use Mac OSX click on the mac folder. To install the library all you have to do is copy these files to the appropriate folders of your operating system.
Lpsolve on Windows
On Windows all you have to do is copy the lpsolve55.dll and lpsolve55j.dll files and paste them in the C:\Windows\System32\ folder (the location is the same both for the 32bit and 64bit versions of the library).
Lpsolve on Unix/Linux
On Unix/Linux you need to copy the lpsolve55.so and lpsolve55j.so files in the lib directory of your operating system. The location might differ depending on the distribution that you use. For example if you use the 64bit flavour of Ubuntu 14.04 you should copy the files to /usr/lib/ folder. Other versions or distributions might require you to copy them on slightly different location (for example on CentOS 6 uses the /usr/lib64/ folder instead).
Make sure you avoid installing lpsolve by using package managers such as yum or apt-get because it is highly likely you will end up having the wrong version of the library.
Lpsolve on Mac OSX
If you are a Mac user check out this tutorial on how to compile and install the lpsolve libraries.
Step 3: Add datumbox as a dependency on your Maven Project
Last but not least add the Datumbox Framework as a dependency on your Maven Project. To do this open the pom.xml of your project with your favourite IDE or editor and add it inside the dependencies tag the following entry:
<version>RELEASE</version><!-- or use a specific version -->
That’s it! You can now use the framework in your project!