# Recurrent Networks Hello World in Clojure with new Deep Diamond RNN support on CPU and GPU

DevFeed: [Recurrent Networks Hello World in Clojure with new Deep Diamond RNN support on CPU and GPU](<https://devfeed.tech/articles/recurrent-networks-hello-world-in-clojure-with-new-deep-diamond-rnn-support-on-cpu-and-gpu-20724.md>)

Original publisher: [Read original article](<http://dragan.rocks/articles/22/Recurrent-networks-hello-world-sequence-prediction-in-Clojure-with-new-Deep-Diamond>)

Published: 2022-08-26T14:25:00Z

Content type: tutorial

Language: en

Sources: [Dragan Djuric](<https://devfeed.tech/sources/dragan-djuric.md>)

Topics: [Clojure](<https://devfeed.tech/topics/clojure.md>), [Deep learning](<https://devfeed.tech/topics/deep-learning.md>), [Time Series](<https://devfeed.tech/topics/time-series.md>), [Programming](<https://devfeed.tech/topics/programming.md>)

Tags: [clojure](<https://devfeed.tech/tags/clojure.md>), [cpu](<https://devfeed.tech/tags/cpu.md>), [deep](<https://devfeed.tech/tags/deep.md>), [deep-learning](<https://devfeed.tech/tags/deep-learning.md>), [diamond](<https://devfeed.tech/tags/diamond.md>), [gpu](<https://devfeed.tech/tags/gpu.md>), [learning](<https://devfeed.tech/tags/learning.md>), [networks](<https://devfeed.tech/tags/networks.md>), [neural](<https://devfeed.tech/tags/neural.md>), [programming](<https://devfeed.tech/tags/programming.md>), [recurrent](<https://devfeed.tech/tags/recurrent.md>), [rnn](<https://devfeed.tech/tags/rnn.md>), [time-series](<https://devfeed.tech/tags/time-series.md>)

## AI overview

A beginner-friendly Clojure tutorial demonstrates recurrent neural networks in Deep Diamond by training a model to predict the next value in a simple numerical sequence. It introduces time-series prediction and notes that the example can run on CPU and GPU.

## Source excerpt

I've been busy in the last period working on new major features in Deep Diamond, one of which is the support for Recurrent Neural Networks (RNN). It's not been an easy ride, but I can finally show you some results! Big thanks for everyone that's helping me with this by buying my books (or subscribing to the upcoming editions), and Clojurists Together, who generously funded me in the past year to work on this. I know that most of you probably don't have much more than passing familiarity with deep learning, let alone recurrent neural networks, and that's why I'll try to show a very simple example on the level of Hello World that anyone interested in machine learning and programming can understand and try. So, enough talk, let's get down to business. What are we doing We are demonstrating a hammer: recurrent neural networks. Just kidding; we would like to create a (software) device that can learn to predict the next data point in a series. Depending on the data, this can be done in a number of ways (even by convolutional neural networks (CNN) that Deep Diamond already supported), one of which is RNN. So, we are creating a recurrent network, and training it with a set of data for this task. An example of data that fits this task would be temperature at some place, stock prices, and any other (possibly infinite) sequence of numbers in one of more dimensions that have an ordinal relation, that is, has an abstract notion of time attached to it. Then, we are trying to forecast one or more values that are happening in the future (temperature the next day, or the closing price of a stock, etc.). Since Hello World has to be dead simple, a real example would have too many opaque numbers, so we'll solve an artificially trivial task of teaching our network to predict the next number in the series for obvious series such as 1, 2, 3, 4, 5. Of course, in real life we rarely need to solve that exact task with such a bazooka as RNN, but if this is your first contact with time series