Recommendation system for the Animal Crossing

Matthew Leung
2 min readOct 31, 2020

Animal Crossing is a popular game I love. They released their public data on Kaggle.com. And one of the kaggle task is to recommend an interior design setup for each villager. Here I will illustrate how I use the python package “turi create” to build such a recommendation system.

The public data that the Animal Crossing shared on kaggle can be found in this link. The “villagers.csv” contains the preference of each villagers such as the color it likes, and also a list of furniture it possesses. The furniture item ID corresponds to the Internal ID of items in other tables such as housewares.csv and wall-mounted.csv. Each furniture item has different color or style to choose.

To build a recommendation system, first we need to build the user-item-rating table. I use the villagers table to join with the housewares and wall-mounted table on the furniture item id. The rating is calculated by comparing the villager’s color preference with the furniture color. If both the columns
color1 and color2 match, it will have the max rating of 5. Otherwise, it will have 4 if it only match 1 color, and will have min rating of 3 if none matches.

Then I use the recommendation package provided by the python package “Turi Create” to train with the above user-item-rating table. Turi create is a machine learning package introduced in WWDC which aims at simplifying the development of custom machine learning models. I tried different recommenders provided by Turi Create, and found that the item_similarity_recommender provided a better result. The model make recommendations based on some notion of similarity between a pair of items. The model definition and the similarity formula can be found in the turi create documentation.

m2 = tc.item_similarity_recommender.create(train,target='rating')

The training is just a line of python code as above. It already gaves a precision of 87%.

recommendations = m2.recommend()

Just another another line of python code as above, we can get the recommendation as below.

From the item id, we can look up the name and other furniture details in the housewares.csv and wall-mounted.csv.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

No responses yet

Write a response