The drawing is generated by a recurrent neural network after training on a dataset of vector sequences. The sequences represent a collection of variously sized squares which fit within another bounding square. For each of the bounding squares the neural network is trained a different number of times, a few starting points are chosen at random and passed to the network, the network then generates four vectors for each side of a square.

The neural network is constructed with Keras LSTM layers, the output from which is transformed into G-code and fed into a homemade pen plotter to draw each generated square to paper.

Sometimes the generated square side vectors fit within the bounding square and resemble a square in shape, other times the shape is not closed and the lines come directly from the default initialised network weights.

The higher the number of training iterations the more likely it is that the selected starting point will result in a more precise and joined up square. This is directly dependent on the training data and whether or not the starting point randomly chosen is covered within it.