I’ve seen some NBA nickname rankings and wanted to see if I could use Deep Learning to generate some of my own.
As training data, I scraped all the nicknames from the basketball nicknames wiki. There were 615 nicknames in total, a pretty small sample size. After lower casing and removing all superfluous punctuation, I added a ‘*’ to the end of each nickname so the model would learn the endpoint of the nicknames. I broke each nickname into 5-character vectors and one-hot encoded each character to create input vectors. I also generated dictionaries to be able to go from the one-hot encoded vectors back to the letters. I then used each set of 5 character vectors as my input, and the next character as my output vector. This gave me a total of 4008 patterns to learn from (still not much, but we can work with it). I leveraged Keras sequential models to built a 5 layered LSTM model. The first few iterations were overfitting and tended towards the same local optimums (addding ‘of all time’ or ‘three’ to each character vector). To control for this, I added dropout layers between each of the 5 LSTM layers. This greatly improved my model’s performance (optimized on categorical cross entropy), which actually backfired from a creativity standpoint. It was essentially predicting the nicknames so accurately that no unique patterns were formed. To address this phenomenon, I applied gradient clipping on the optimizer to prevent it from getting stuck in local optimums, and also used less training iterations so that the model was not simply memorizing the data set. I kept the models trained on 50 and 100 iterations. The network architecture is summarized below.
Layer (type) Output Shape Param # ================================================================= lstm_25 (LSTM) (None, 5, 256) 264192 _________________________________________________________________ dropout_25 (Dropout) (None, 5, 256) 0 _________________________________________________________________ lstm_26 (LSTM) (None, 5, 256) 525312 _________________________________________________________________ dropout_26 (Dropout) (None, 5, 256) 0 _________________________________________________________________ lstm_27 (LSTM) (None, 5, 256) 525312 _________________________________________________________________ dropout_27 (Dropout) (None, 5, 256) 0 _________________________________________________________________ lstm_28 (LSTM) (None, 5, 256) 525312 _________________________________________________________________ dropout_28 (Dropout) (None, 5, 256) 0 _________________________________________________________________ lstm_29 (LSTM) (None, 5, 256) 525312 _________________________________________________________________ dropout_29 (Dropout) (None, 5, 256) 0 _________________________________________________________________ lstm_30 (LSTM) (None, 256) 525312 _________________________________________________________________ dropout_30 (Dropout) (None, 256) 0 _________________________________________________________________ dense_5 (Dense) (None, 29) 7453 ================================================================= Total params: 2,898,205 Trainable params: 2,898,205 Non-trainable params: 0 _________________________________________________________________
I then used all the initial 5 character sequences that started each nickname, along with each 5 character word in each data set. I also added a few unique 5 character starting points of my own just to make sure it came up with a lot of funky output (‘the a’, ‘the b’, ‘the c’,…..). These starting parameters were fed forward through the network to create unique nicknames. The model still definitely has some local minimum that it keeps exploiting ( adding ‘mids’ to nicknames, etc.), but there are also some pretty creative nicknames it came up with on its own. Out of the 1300+ nicknames it generated, I have selected 13 that I particularly like and found players/teams that fit them.
Shot Rod: Klay Thompson
Klay is one of the greatest shooters of our era, and also has an Andy Sandberg type goofiness. I think this fits nicely.
Road Warrin: Russell Westbrook
Russ loves nothing more than going nuts in the face of a booing crowd.
Tricky Buckets: Kyrie Irving
Kyrie’s unbelievable ball-handling and layup finishes lead to some of the craftiest buckets you’ll see.
Noon Three: J.R. Smith
J.R. will take basically any three on the court regardless of the game situation and also looks like he woke up at noon at all times.
Melo is the active leader in buzzer beaters and is one of the great iso scorers in the game. He also kills shot clocks like nobody’s business.
Blitz Mid: Demar DeRozan
Demar DeRozan is the king of the midrange and has some great slashing finishes.
Gets Me All (the) Time: Donovan Mitchell
Donovan Mitchell seems to have a new move every day and knows exactly what to pull out of his bag of tricks at the right time.
Dice Cream: Michael Beasley
An incredibly smooth skillset, but you never know which version will show up: the irrefutable talent or the lazy brick layer. (I wish this nickname fit a better player because it is badass)
Free Party: 76ers
Pretty much all the cool history of America happened in Philadelphia, and Jojo is basically a walking party as well.
Sauce Cast: the Rockets contributors
PJ Tucker and Gerald Green are sauce icons and perfectly compliment the cooking abilities of Harden and CP3.
Pogo Towers: DeAndre Jordan and Blake Griffin
Two of the highest flying bigmen in the same frontcourt produced some of the greatest in-game dunks of all time.
Let me know if you like these fits or can think of better ones. Check out the notebook and all of the other names outputted here. There are definitely some other nickname candidates and also some hilariously weird word combinations.
(Code adapted from Machine Learning Mastery’s great tutorial for text generation using LSTMs.)