How I wrote a terrible machine learning Nirvana song


We all see articles on how this is successful or that is successful and we get to brag about our successes. But what about when we fail? What about when it’s an #epicfail? I’ve gone through tons of code learning how to do machine learning for many types of things, but one thing intrigued me, writing songs and books.

I have yet to try to write a new version of Harry Potter, but taking on a band’s song lyrics aren’t nearly as complex considering how short the songs are. The issue it appears are the patterns that reoccur or how simple some artists’ songs are.

When I first wrote this RNN to produce Beatles lyrics I realized that they have songs that don’t follow the verse-chorus-verse. Take the song “Help” which flips that on its head. And what about songs that have no chorus like “Hey Jude” or “In My Life.” My machine learning algorithm’s machine brain was smoking.

So, instead I decided to give Nirvana a try. Simpler songs, pretty standard verse-chorus-verse and I knew enough that determining good or bad lyrics would be easy.

The problem is that Kurt Cobain repeated words, a lot. And my program shows how that can just muck up a song fast.

Here is an example:

“Pain Pain Pain Pain us / A denial a denial, a denial, and all the sun Light it wind”

The rest of the song is terrible. Words don’t make sense. Can you tell me what this means? “What is sucker this /In the pinese she meress”

Sometimes predictions are amazing and we are surprised at the power of deep learning and machine learning but they can also suck. Of course, it could just be that my program is terrible, that would be no surprise, however following this similar coding and we can predict fairly well the next word used in any type of text.

I’m going to share the code in case you want to build off it, test it with Taylor Swift lyrics or just see how bad of a song you can write.

One major note that changes with music, which may mean this writes a great book off Stephen King books, is that lyrics rhyme. If my program rhymes it’s by accident. Feel fry to write something that rhymes. I haven’t gotten that far yet as this was an attempt to learn how to write songs on the shoulders of other data scientists’ awesome programs.

Enjoy and maybe start a band and go write some horribly bad machine learning songs.


Please enter your comment!
Please enter your name here