Skip to content
Tanmay Bakshi edited this page Jul 23, 2018 · 2 revisions

Short Name

Turi Create-powered movie recommender system

Short Description

Use Turi Create to recommend movies to users based off of their past favourites

Offering Type

Cognitive

Introduction

This code pattern is an iOS Application that helps you find new movies to watch! It's been built to show you how you can use Turi Create, Apple's new deep learning framework, to build amazing recommendation systems very quickly, locally, on your machine - in under 2 minutes training time.

Author

By Tanmay Bakshi

Code

Demo

  • N/A

Video

  • N/A

Overview

Turi Create is a special machine learning library - it allows you to process datasets with up to billions of rows and millions of features in those rows, all on hardware you probably already have. In this pattern, you're going to learn how you can use this library to ingest the full MovieLens recommendation dataset (20,000,000 rows!); then you'll create an iOS Application that makes use of that machine learning library through a flask-powered backend.

When the reader has completed this Code Pattern, they will understand how to:

  • Create "Item Similarity" recommender models in Turi Create
  • Use Flask to expose a REST API that provides recommendations based off of users' past movie ratings
  • Call that REST API from Swift to create a GUI around the recommender

Flow

  1. Download the MovieLens latest dataset (at the time of writing, there are 26,000,000 rows of data).
  2. Train an item similarity recommender with turi create on MovieLens.
  3. Expose that model through a REST API with Flask.
  4. Open a tunnel to the REST API with ngrok.
  5. User searches for and rates movies on the iOS app.
  6. iOS app sends the movie rating data to the REST API.
  7. The REST API will provide the iOS App with a list of movies and their scores.
  8. The iOS App will display those movies and scores.
  9. User will watch & rate those movies, and go back to step 6, getting better recommendations every time.

Included components

  • Turi Create: is a task-focused deep learning library - allowing you to build intelligent apps by focusing on the machine learning use case, not the algorithm.
  • Flask: is a micro web framework.
  • ngrok: allows you to open an HTTPS tunnel into your REST API.

Featured technologies

  • Artificial Intelligence: Artificial intelligence can be applied to disparate solution spaces to deliver disruptive technologies.
  • Python: Python is a programming language that lets you work more quickly and integrate your systems more effectively.

Blog

Blog Title

Use Turi Create to create a Movie Recommender for iOS

Blog Author

Tanmay Bakshi

Blog Content

Have you ever been frustrated – because you can’t find a good movie to watch? Or maybe a song to listen to?

That situation is a thing of the past – now, with machine learning, you can find new content that you’ll love, instantly. The best part? You’re going to build the system step-by-step in this code pattern (hyperlink).

To begin, you’ll need some data to train the machine learning model – more specifically, you’ll need lots of movie rating data from other users.

Luckily, we have an abundance of this data from the MovieLens dataset (hyperlink) (over 26,000,000 rows of data!). Then, you need a way to analyze this data. You could go ahead and build a custom model with Tensorflow (hyperlink), Keras (hyperlink), or maybe using fasttext (hyperlink). However, since we’re working with a lot of data, and we’re trying to build a recommender system, there’s another library that comes to mind: Turi Create, Apple’s new, open-source, machine learning library written in Python with built-in support for Core ML 2.0.

Turi Create, is a task-focused machine learning library that can work with up to billions of data points and millions of features in those data points. The best part, however, is that it works with massive data repositories on regular, commodity hardware; it does this by leveraging not only the memory on your computer, but by also reading data directly from disk when needed. Plus, since Apple is the one developing the library, it’s optimized for their hardware, so running on a Mac is even faster.

However, if you don’t have a Mac, don’t worry! While you won’t be able to run the iOS Application, Turi Create is compatible with most Linux distros, and will even run on Windows with WSL.

In essence, all of this means that you can train a full-fledged recommender system, without needing to focus on the machine learning algorithm itself, on your MacBook Pro, in under 2 minutes, by leveraging over 26 million rows of data.

Now, you’ll no longer spend the majority of your time finding a movie to watch – you’ll be enjoying it instead – and because Turi Create deals with the algorithms for you, it’s really easy to get started.

So if you’re a developer, I’d highly recommend you give it a try (add link to git repo)! If you don’t have an iOS device, don’t fret, you can run your app in the iOS simulator. No mac? The screenshots above are just for the frontend – you can still run the machine learning algorithms on the OS of your choice.

Links

  • Artificial Intelligence Code Patterns: Enjoyed this Code Pattern? Check out our other AI Code Patterns.
  • AI and Data Code Pattern Playlist: Bookmark our playlist with all of our Code Pattern videos
  • With Watson: Want to take your Watson app to the next level? Looking to utilize Watson Brand assets? Join the With Watson program to leverage exclusive brand, marketing, and tech resources to amplify and accelerate your Watson embedded commercial solution.