An Engineer's Literary Notebook

Exploring the real and surreal connections between poetry and engineering

Archive for March, 2018

A Poetic Application of Artificial Intelligence

Posted by xbanguyen on March 18, 2018

So spring comes again.  The unfurling daffodils are a welcoming sight after the long winter. And if you happen to wander lonely as a cloud, would the memory of daffodils past make you smile, or would you weep for the fading of the daffodils yet to come as Robert Herrick did a few centuries ago?  It could also happen that neither Wordworth’s nor Robert Herrick’s poem satisfies  and you want to train an artificial neural network to select a poem for you, a poem that matches what you long for at this very moment, by feeding it with copious quantity of  poems you ever plainly love.  Suppose that you train it with poems by Edna Saint Vincent Milay, Gerard Manley Hopkins, he of the dappled things,  Heather McHugh, Emily Dickson of the slant light, Huy Can, A. E. Stallings, Dylan Thomas along with the feeling that each poem invokes, creating the necessary  weight for  each feeling to quantify the bias for the neurons in the hidden layer(s) of the network. Of course this is an oversimplication of why we read poetry, but one must start somewhere.

Using feeling as an input parameter is fraught with subjectivity, but we are not traversing new territory. Pain has been graded on a scale of 1 to 10 so why couldn’t pleasure be measured? Pleasure is one of the reasons for poetry to endure.  Even if subjectivity is expected — the neural network we design here is selecting a poem especially for you — to quantify the pleasure a poem provides to create bias to the hidden layer of  our neural network is still difficult.  Which of these poems should have a larger bias?

Rhyme may be a parameter for some readers but not for others.  For this reader, it is.  I remember the first time being drawn to the poem that starts with these lines, and the  welcome attraction has stayed with me ever since. The pleasure it provides surprises me anew every time I read it.

Of course words matter.   Our artificial neural network learns the words in the poems we love to introduce to us poems that we will love.  Given the infinite number of nuances in the permutation of words, does this neural network need to be a deep neural network that has at least two hidden layers to be able to provide meaningful output of a higher quality than the “you may also like” recommendation of certain on-line merchant? 

The answer is uncertain because training deep neural networks is still largely done by trial and error. In fact, there have been talks of  machine learning as alchemy.

That machine learning is equated to alchemy is poetry in itself.  And it is fitting that we use a poetic device to select poetry for our enjoyment.  If we were to be successful in devising such a network, I hope that it will point me to this poem.

Thank you for the inspiration, dear muse.


  1. The daffodils photo is from
  2. The neural network diagram is from
  3. The trial and error nature of neural network is from
  4. The machine learning as alchemy talk is at
  5. Many thanks to A.E Stallings and Matthea Harvey for writing my favorite poems.


Posted in Uncategorized | Leave a Comment »

%d bloggers like this: