Quick Start
Step by step guide for downloading, installing and running a minimal example.
1. Prerequisites
Java 8 or higher
Deep Netts requires Java version 8 or higher installed.
Java is available for download at https://www.oracle.com/java/technologies/downloads/
Apache Maven Build Tool (optional)
Maven build tool is the easiest and recommended way to use Deep Netts.
Maven is available for download for free from https://maven.apache.org/download.cgi
Maven installation is just unpacking the downloaded archive and setting environment variables
For more details depending on OS see https://maven.apache.org/install.html
2. Download
The latest Deep Netts is available for free download from here
The download package includes the Visual AI Builder and Deep Netts deep learning Java library.
3. Installation
Installation of Deep Netts Platform consist of installing the following two components:
- Visual AI Builder development tool
- Deep Netts deep learning Java Library
3.1. Visual AI Builder Installation
Visual AI Builder installation is performed by unzipping the provided application zip file:
- Unzip downloaded package deepnetts.zip
- Unzip deepnettsplatform.zip provided in the distribution package (deepnetts/deepnettsplatform.zip)
- Start Deep Netts by running
deepnettsplatform/bin/deepnettsplatform64.exe for Windows or
deepnettsplatform/bin/deepnettsplatform64 for Mac or Linux. For Linux make sure that the file has executable permissions.
Or make sure that it is executable by running the following command: chmod +x deepnettsplatform64
3.2. Local Maven installation of Deep Netts deep learning library
To be able to use Deep Netts in your Maven-based Java applications install provided jar files (including license jar) into your local Maven repository. You can do that using scripts provided in the distribution package:
ImportToLocalMaven.bat for Windows
importToLocalMaven.sh for Linux and Mac
If everything went well, after running the import scripts you should be able to find Deep Netts library and license in .m2/com/deepnetts directory. Location of your local Maven repository is commonly {USER_DIR}/.m2
Where {USER_DIR} is your user home directory c:\Users\Username on Win or /home/username on Linux
3.3. Adding dependencies to Deep Netts deep learning library in your Java project
Maven Based Java project
To add Deep Netts to your Maven based Java project, copy and paste the following snippets to <dependencies> section in pom.xml file of your project. Just replace the x.x.x with the corresponding Deep Netts version that you have downloaded.
<dependency>
<groupId>com.deepnetts</groupId>
<artifactId>deepnetts-core-pro</artifactId>
<version>x.x.x</version>
</dependency>
<dependency>
<groupId>com.deepnetts</groupId>
<artifactId>deepnetts-license</artifactId>
<version>1.0</version>
</dependency>
This will add Deep Netts library and license file to your project and all related dependencies.
ANT Based Java Project
To add Deep Netts to your ANT based project, add all jar files provided in DeepNettsEngine directory from downloaded Deep Netts distribution to your project.
4. Running first example (Hello world!)
Iris Flowers Classification – A Multi Class Classification task. Assign flower to one of three categories based on their dimensions. You can run this example from your favourite IDE using maven project at Examples/deepnetts-examples or from th command line using following commands:
cd Examples/deepnetts-examples
mvn clean package
mvn exec:java -Dexec.mainClass=deepnetts.examples.IrisFlowersClassification
public class IrisFlowersClassification {
private static final Logger LOGGER = LogManager.getLogger(DeepNetts.class.getName());
public static void main(String[] args) throws DeepNettsException, IOException {
// load iris data set
DataSet dataSet = DataSets.readCsv("datasets/iris-flowers.csv", 4, 3, true, ",");
TrainTestPair trainTest = DataSets.trainTestSplit(dataSet, 0.65);
// normalize data using max normalization
MaxNormalizer norm = new MaxNormalizer(trainTest.getTrainingeSet());
norm.normalize(trainTest.getTrainingeSet());
norm.normalize(trainTest.getTestSet());
// create instance of feed forward neural network using builder
FeedForwardNetwork neuralNet = FeedForwardNetwork.builder()
.addInputLayer(4)
.addFullyConnectedLayer(8, ActivationType.TANH)
.addOutputLayer(3, ActivationType.SOFTMAX)
.lossFunction(LossType.CROSS_ENTROPY)
.randomSeed(123).
build();
// create and configure instanceof backpropagation trainer
BackpropagationTrainer trainer = neuralNet.getTrainer();
trainer.setMaxError(0.03f)
.setMaxEpochs(1000000)
.setLearningRate(0.1f);
trainer.train(trainTest.getTrainingeSet());
ClassifierEvaluationResult ceResult = Evaluators.evaluateClassifier(neuralNet, trainTest.getTestSet());
LOGGER.info("Classification performance measure" + System.lineSeparator());
LOGGER.info(ceResult);
// shutdown the thread pool
DeepNetts.shutdown();
}
}