Examples - Overview

In this section you will find some examples that show how the JLayer Framework can be used.

  • The first example, which implements Conway's Game of Life, is best suited for an introduction.
  • The three following examples - Hopfield Network, Kohonen Network, Backpropagation Network - use different artificial neural network types to show that the clear separation between the description of the local core functionality on the one hand and the link structure and global functionality on the other leads to compact and clear programming code.
  • The two final examples - Parameter Passing and Parallelisation and Mandelbrot Set - are used to demonstrate further possibilities of the JLayer framework.

Game of Life

This example implements Conway's Game of Life. It introduces the JLayer Framework and shows the application of the JLayer annotations @LayerUnit, @LayerField and @LayerMethod. Moreover, it shows how a mathematical relation over indices is used to connect layers.

  • Unit Class LifeCell is used for coding the game from a cell's point of view.
  • Class LifeUniverse establishes the global structure and adds the global dynamics.

For more information, follow the links on the right side.


Hopfield Network

In this example, a so-called Hopfield Network is implemented, an auto-associative network that consists of only one layer and can be used to store patterns. Here, a field layer with element type int[] is used as an automatically calculated "index layer" and a self-defined relation is used to link objects.

  • Unit Class HopfieldUnit provides the core methods for saving and reconstructing patterns.
  • Class HopfieldNet establishes the global structure and adds the global dynamics.

For more information, follow the links on the right side.


Kohonen Network

The Kohonen network is a self-organising map that is trained by unsupervised competitive learning. The aim is to generate a low-dimensional (typically two-dimensional) representation of a higher-dimensional data set. Like in the last example, a field layer with element type int[] is used as an automatically calculated "index layer" and a self-defined relation is used to link objects.

  • The unit classes for modelling the local core functionality are KohonenUnit and DecisionUnit.
  • Class KohonenNet establishes the global structure and adds the global dynamics.

For more information, follow the links on the right side.


A Backpropagation Neural Network

This example implements a simple backpropagation neural network with one hidden layer, which can be used to find an encoding for a number of given patterns. It illustrates the application of the JLayer annotation @LayerParam and shows how a mathematical relation over indices is used to associate layers.

  • The unit classes for modelling the local core functionality are Input, Hidden and Output.
  • Class EncoderNetwork establishes the global structure and adds the global dynamics.

For more information, follow the links on the right side.


Parameter Passing and Parallelization

This is a fairly contrived example showing the variant ways parameters can be passed to method layers. In addition, it allows testing the looping implementation of method layers against the parallel implementation that tries to use all available processor cores.

  • Unit class DemoUnit contains annotated methods that represent all intended cases.
  • Class DemoLayers establishes the global structure and adds the global dynamics.

For more information, follow the links on the right side.


Mandelbrot Set

This program creates an image that takes a while to compute because it takes some computation to compute the color of each pixel in the image. The image represents a part of the mathematical object known as the Mandelbrot set. The sole purpose of this example is to compare the looping implementation of a method layer with the parallel implementation using all available processor cores.

  • The Unit class MandelbrotUnit provides the core of the program, specifically the two methods offered for running in a loop and for running in parallel, respectively.
  • Class MandelbrotNet establishes the global structure and adds the global dynamics.

For more information, follow the links on the right side.