Coding art

I am intrigued by the idea of (mis-)using a program meant for statistical analysis in a clever way, to produce something aesthetic. These figures and animations arise from mathematical equations, which are tweaked and plotted iteratively with for-loops. I mainly code in R, but there are also a couple of figures made with LaTeX, and some acrylic paintings.

In this installation we take a deep dive through a psychedelic wormhole, in search for extraterrestrial life in the Galaxy. We find a distant and exotic planet, orbited by a comet.

The code generating this animation is displayed in the end of the video (speed-ups and music by iMovies). The wormhole and the planet can also be viewed separately below.

The location of every point is determined by mathematical rules (mostly trigonometric functions), and the animation arises as these functions are changed according to update rules, inside for-loops.

Interesting puzzles (and fun details) I encountered while coding the installation:

  • How to keep the structure of the wormhole intact, when moving the end of the tunnel around?

  • How to make the comet go behind the planet on every other turn? It took six if-else-conditions.

  • The locations of the blinking stars change randomly without repeating.

These figures consist of tens of thousands of points, organized into patterns by simple mathematical rules, which can be expressed in a single line of code (the rest is visual settings).

Visualizations revealing different aspects of how a Recurrent Neural Network for binary classification is learning in- and out-of-sample, based on time series data. I programmed the RNN and the visualizations in base R. Each update in the animation corresponds to a training iteration (an epoch) of the network.

  1. Confusion matrix in a histogram: From false negative (FN) to true positive (TP).

  2. Locations of actual events (red) and the predictions by the network (blue) .

  3. Same as above but with raw softmax outputs, interpreted as the confidence of the model on its prediction.

  4. Accuracy: (TN+TP)/(FN+FP+TN+TP). Both training and validation results plotted.

  5. Evolution of the categorical cross-entropy mean loss, from both training and validation sets. The divergence of the two is used as a stopping criterion.

  6. Histogram of the softmax outputs, scaled to [0,100].

I also tried making art without coding. These were the favorites among my first 15 acrylic paintings. Relaxing and fun!

I made this flower using the automata-environment of the tikz-graphical package for LaTeX-document preparation system.

Another artpiece I made with LaTeX. This time I found a way to stack and twist symbols in the align -math environment, creating something that looks like a terrain or a map to me.

This was the first atrpiece I coded using R, which kicked off the franchise for me.

Long version of the wormhole


Long version of the planet