Rommmate Predictor

Published: Updated:

Roommate Predictor is an AI which predicts the author of my roommate’s text messages. The application is served over the web and designed to be viewed on mobile devices. On the homepage, the user can enter a phrase and get the predicted author. Then, they can see a series of messages and test their ability to determine the authors. When they submit the test, their results are compared against the AIs. At this task, the AI performed about as well as my roommates, both with accuracies around 68%.

The homepage, where the user may enter a phrase and get the predicted author. The user may test their prediction abilities by selecting the correct author for each phrase. The user sees how well they were able to predict the phrases compared to the AI.

Technical Details

The AI was written using the allennlp ML framework. The model was trained on about 4000 messages, and 1000 more were set aside for validation. Data was normalized by converting URLs to URL_TOKEN, stripping any formatting like bold and italics. Emojis were kept intact. Each word was embedded into a 300 wide vector, pretrained on glove. The model consisted of a bidirectional LSTM outputting 512 elements each, followed by an additional 1024 element lstm layer which output to the classification layer. Cross entropy loss was used to optimize accuracy.

The website was created using Django. The website exposes a json API to make the predictions on the homepage. The test page is a randomly generated form and the results pages uses the form data to create results. The AI exposes a predict function which returns the probability of each author saying the input phrase.

The entire application was run in a docker container and deployed to an Azure Container Instance. The model was trained on my development machine with a GPU and bundled into the container.