Artificial Intelligence (AI) and Machine Learning for Java

Why Use Java for AI?

And more broadly, why should you use JVM languagues like Java, Scala, Clojure or Kotlin to build AI and machine-learning solutions?

Java is the most widely used programming language in the world. Large organizations in the public and private sector have enormous Java code bases, and rely heavily on the JVM as a compute environment. In particular, much of the open-source big data stack is written for the JVM. This includes Apache Hadoop for distributed data management; Apache Spark as a distributed run-time for fast ETL; Apache Kafka as a message queue; ElasticSearch, Apache Lucene and Apache Solr for search; and Apache Cassandra for data storage to name a few.

Since access to data is a prequisite to building AI and machine-learning solutions, AI tools need to integrate well with those technologies. AI starts with the data you gather. That’s why the AI and machine-learning tooling you choose is crucial. The right tools solve a lot of integration problems (many data science projects fail when prototypes can’t integrate with the production stack), and they will accelerate the digital transformation of many of the world’s businesses.

“Accelerating digital transformation” sounds like a bunch of empty buzzwords, so let’s paraphrase it. Choosing the right machine learning tools allows you to produce more accurate predictions about your data while using your existing technology stack, and those predictions will allow you to make better decisions for your business. Those predictions might be the basis of a cool new product (self-piloting drones) or lead to big cost savings. We have listed the most important machine-learning tools written in Java below.

Deep Learning & Neural Networks

Deep learning usually refers to deep artificial neural networks. Neural networks are a type of machine learning algorithm loosely modeled on the neurons in the human brain. Deep neural nets involve stacking several neural nets on top of each other to enable a feature hierarchy for more accurate classification and prediction. Deep learning is the state of the art in most tasks or machine perception, involved classification, clustering and prediction applied to raw sensory data.

Eclipse Deeplearning4j

Eclipse Deeplearning4j is the most widely used open source deep learning library for Java and the JVM. It includes multilayer perceptrons, convolutional neural networks (CNNs) for image and text classification, recurrent neural networks such as LSTMs for text and time series data, and various autoencoders like VAEs and GANs. Its auto-differentiation library, SameDiff, allows developers to create any neural network. It has a Scala API and uses Keras as its optional Python API. The official website provides many tutorials and simple theoretical explanations for deep learning and neural networks. Deeplearning4j includes machine-learning algorithms such as logistic regression and k-neurest neighbors.



Neuroph is an open-source Java framework for neural networks. Developers can create neural nets with the Neuroph GUI. The Neuroph API documentation also explains how neural networks work.

Arbiter (Hyperparameter Optimization for Java)

Eclipse Arbiter is a hyperparameter optimization library designed to automate hyperparameter tuning for deep neural net training. It is the equivalent of Google Tensorflow’s Vizier, or the Python library Spearmint. Arbiter is part of the Deeplearning4j framework.

Expert Systems

An expert system is also called a rules-based system. The rules are typically if-then statements; i.e. if this condition is met, then perform this action. An expert system usually comprises hundreds or thousands of nested if-then statements. Expert systems were a popular form of AI in the 1980s. They are good at modeling static and deterministic relationships; e.g. the tax code. However, they are also brittle and they require manual modification, which can be slow and expensive. Unlike, machine-learning algorithms, they do not adapt as they are exposed to more data. They can be a useful complement to a machine-learning algorithm, codifying the things that should always happen a certain way.


Drools is a business rules management system backed by Red Hat.

Natural-Language Processing

Natural language processing (NLP) refers to applications that use computer science, AI and computational linguistics to enable interactions between computers and human languages, both spoken and written. It involves programming computers to process large natural language corpora (sets of documents).

Challenges in natural language processing frequently involve natural language understanding (NLU) and natural language generation (NLG), as well as connecting language, machine perception and dialog systems.


Apache OpenNLP is a machine-learning toolkit for processing natural language; i.e. text. The official website provides API documentation with information on how to use the library.

Stanford CoreNLP

Stanford CoreNLP is the most popular Java natural-language processing framework. It provides various tools for NLP tasks. The official website provides tutorials and documentation with information on how to use this framework.

Machine Learning

Machine learning encompasses a wide range of algorithms that are able to adapt themselves when exposed to data, this includes random forests, gradient boosted machines, support-vector machines and others.


SMILE stands for Statistical and Machine Intelligence Learning Engine. SMILE was create by Haifeng Lee, and provides fast, scalable machine learning for Java. SMILE uses ND4J to perform scientific computing for large-scale tensor manipulations. It includes algorithms such as support vector machines (SVMs), decision trees, random forests and gradient boosting, among others.


Apache SINGA is an open-source machine-learning library capable of distributed training, with a focus on healthcare applications.

Java Machine Learning Library (Java-ML)

Java-ML is an open source Java framework which provides various machine learning algorithms specifically for programmers. The official website provides API documentation with many code samples and tutorials.


RapidMiner is a data science platform that supports various machine- and deep-learning algorithms through its GUI and Java API. It has a very big community, many available tutorials, and an extensive documentation.


Weka is a collection of machine learning algorithms that can be applied directly to a dataset, through the Weka GUI or API. The WEKA community is large, providing various tutorials for Weka and machine learning itself. WEKA uses Deeplearning4j for its neural network implementation.

MOA (Massive On-line Analysis)

MOA (Massive On-line Analysis) is for mining data streams.

Encog Machine Learning Framework

Encog is a Java machine learning framework that supports many machine learning algorithms. It was developed by Jeff Heaton, of Heaton Research. The official website provides documentation and examples.

Reinforcement Learning

Eclipse RL4J

RL4J is a reinforcement learning library for Java that is part of the Eclipse Deeplearning4j framework. RL4J examples for A3C and Deep-Q learning are here.


The Brown-UMBC Reinforcement Learning and Planning is for the use and development of single or multi-agent planning and learning algorithms and domains to accompany them.

Scientific Computing/Numerical Computing for Java

All machine learning libraries depend on some form of scientific computing.

Eclipse ND4J: Numpy for the JVM

ND4J stands for n-dimensional arrays for Java. An n-dimensional array is also called a tensor. ND4J is Numpy for the JVM. It is the most powerful and flexible scientific computing framework available for JVM languages such as Java and Scala. ND4J uses JavaCPP and libnd4j (a C++ library) to perform large matrix manipulations efficiently. ND4J Github Repository. Unlike jblas, ND4J is under active development.

Other Introductory Resources

For people just getting started with deep learning, the following tutorials and videos provide an easy entrance to the fundamental ideas of feedforward networks:

Chat with us on Gitter