An independent implementation of DeepMind's AlphaGoZero in Scala, using Deeplearning4J (DL4J)

View the Project on GitHub maxpumperla/ScalphaGoZero

ScalphaGoZero Build Status

ScalphaGoZero is an independent implementation of DeepMind’s AlphaGo Zero in Scala, using Deeplearning4J (DL4J) to run neural networks. You can either run experiments with models built in DL4J directly or import prebuilt Keras models.

ScalphaGoZero is mainly an engineering effort to demonstrate how complex and successful systems in machine learning are not bound to Python anymore. With access to powerful tools like ND4J for advanced maths, DL4J for neural networks, and the mature infrastructure of the JVM, languages like Scala can offer a viable alternative for data scientists.

This project is a Scala port of the AlphaGo Zero module found in Deep Learning and the Game of Go.

Getting started

Here’s how run after cloning:

cd ScalphaGoZero
sbt run

This application will set up two opponents, simulate 5 games between them using the AlphaGo Zero methodology and train one of the opponents with the experience data gained from the games. For more extensive experiments you should build out this demo.

To use Keras model import you need to generate the resources first:

cd src/test/python
pip install tensorflow keras

The generated, serialized Keras models are put into src/main/resources and are picked up by the KerasModel class, as demonstrated in our tests.

Core Concepts

Quite a few concepts are needed to build an AlphaGoZero system, ScalphaGoZero is intended as a software developer friendly approach with clean abstractions to help users get started. Many of the concepts used here can be reused for other games, only the basics are really designed for the game of Go.


ScalphaGoZero can be improved in many ways, here are a few examples: