Before I started on my own AI-related venture, I didn’t know anything about it. I knew what it was, but I couldn’t begin to explain how things worked. Turns out, I can learn a lot when I can add “motivation” to the list of ingredients (no pun intended). Everything that interests me, will stick in my mind forever.
One of the most beautiful things was that I’m doing exactly the same thing as when I was that naive 13-year old kid that just started programming. I learned bits and pieces about programming languages, if-else clauses, loops etc, until the pieces fell together. Then I started building stuff, I didn’t look up or around: this was the destiny for me.
Now I’m 25 and I’m doing the same thing with AI, and it’s awesome. I gave my first AI-related talk 2 weeks ago.
— bart roorda (@bartroorda) 14 maart 2017
One of the things I wanted to do was something that hasn’t been done before (at least not publicly).
So I built an AI that comes up with brandable domain names. Which from now on I refer to as NameAI
When I started “NameAI”. I didn’t expect much, but I was really suprised by the results! After half an hour I already got a lot of good names (like kixely.com).
If you want to dive straight in the source-code, see the bottom of this post with the Github link!
I started with a fairly common stack for AI-research: Python, Keras (with Theano backend), and Jupyter. You don’t need a strong GPU, a CPU is enough (everything >= Core i5 would be quick).
My dataset is a text-file consisting of ~25k brandable domain names, with 1 domain per line. Unfortunately, I can’t share the dataset publicly, since I ripped it from various websites (like brandbucket.com) but you can easily make your own.
After a brief moment of fiddling around with the parameters and data pipeline, I found the best way to achieve good name prediction. Our model consists of a single GRU layer with 128 units (which is quite small). My goal was that NameAI would learn the linguistics of what makes a name brandable, in which case such a small model is a perfect fit.
The data pipeline consists of our ~25k domain names corpus being split up at each character (i.e codebuffet.co will be split like this: [ ‘c’, ‘o’, ‘d’, ‘e’, ‘b’, ‘u’, ‘f’, ‘f’, ‘e’, ‘t’, ‘.’, ‘c’, ‘o’ ]).
In the initial run, we count the length of the longest domain name in the corpus, and then left-pad every shorter domain with a ‘_’ until it’s as long as the longest domain. This way each domain name is equally long, and we can also use the _ to determine how long our name will (or has to) be.
The data flows through the network in a time-series window of 3 characters.
A window of 3 characters means that the network will keep in mind the past 3 characters, while predicting the next single character. For domain names, I found this one of the best ways, since many of the vowels remain preserved in steps of 3 characters in the English language.
The training itself is unsupervised, which means that the input data is not labeled, and there is no validation. There is no way to measure the accuracy except by looking at the domains that come out of it, and see if it matches your satisfaction.
I did this, because we don’t want our network to validate against our input, we want it to come up with new names, and this is exactly where unsupervised learning is really good at: For example, while it can’t figure out what a face is from a series of pictures (without some validation-set marking the area of the face), it can cluster all the faces from pictures into different groups and output combinations of those groups.
This is the same with our names: imagine ‘.com’ at the end of each name, but also ‘ly’ which is quite common to append to English words, like timely or bitly.
After each iteration we ask NameAI to make a domain name starting with each letter of the alphabet (including difficult ones like X, Q, Z etc, we really want to push it’s limits here).
After the first iteration we have a lot of gibberish, which is no surprise. It looks like this:
After about 5 iterations we really start to see some results:
This has been an amazing project to do! With a decent amount of examples in a corpus, you can get as many different names as you like. It probably works too for other type of names, like Pokemon names.
Maybe my (or your!) next startup name will come from Name AI 🙂 We’ll see.
I’m glad to share this with you guys, if you have any questions or suggestions for a follow-up – just let me know!
The full source code is at: My Github