Shadoopy. Dango. Ray-Bella. Figgie.
If I told you those were names of actual dogs in New York City, would you believe me?
They’re not. They were generated by a machine-learning algorithm mimicking dog names after it “studied” a list of 81,542 dogs registered in NYC.
The experiment, which took just a few hours Saturday, was something I’ve wanted to try since I saw the playful, awesome work of Janelle Shane and her experiments using neural networks to generate paint colors, guinea pig names and Harry Potter fan fiction.
I happened to have some free time, and decided to give it a shot. Along the way I:
The program generated lots of names, including many that existed in the original data. Once I filtered those out, I had almost 400 computer-created, mostly plausible dog names. Here are some of my favorites:
If you’d like to geek out about how I did this, read on. You can do it, too.
Shane describes using char-rnn for her projects. “Char-rnn all the things,” she says.
Char-rnn ALL THE THINGS! https://t.co/dsL7PoVyrz
— Janelle Shane (@JanelleCShane)
The char-rnn documentation is pretty great, and has some helpful info. It also suggests using torch-rnn as a new, faster way to do this character-based learning. I knew I’d have access to Torch on my cloud computer, so I went with torch-rnn.
All the cool kids are using GPUs — graphics processing units — for machine learning. Unlike the CPU (central processing unit) that runs your laptop or desktop, GPUs are chips designed for the fast, simultaneous computations needed for video, graphics, and gaming. And that power happens to be excellent for machine learning programs.
Buying, configuring and running a computer to use GPUs for machine learning can be tricky. I’ve tried. But at an artificial intelligence conference last week I learned that I could spin up a fully-configured computer with all the necessary gear in the cloud. And it takes about 3 minutes to set up.
The “cloud” computer actually lives in the Amazon Web Services (AWS) system. Learning the AWS landscape and its plethora of three-character creatures is trickier than it should be. If you’ve never done it, it’ll take some work. (Here’s how I teach it to college students.) But for anyone already comfortable starting an Elastic Compute Cloud (EC2) instance, it’s pretty straightforward.
If you try this yourself, be careful with the instance size you pick! The p2.xlarge is about a dollar an hour. The next size up is $7.20 an hour. Also, you’ll want to be sure to “stop” the instance when you are done playing — a dollar an hour adds up quickly!
Once I spun up the Amazon computer, I roughly followed the instructions in the torch-rnn repo. Since Torch is already loaded on that computer, but not fully installed, I had to add some steps and eliminate some others.
Photo taken in New York City’s Inwood Hill Park by Steve Guttman, used under creative commons from Flickr.