Quantcast
Channel: mongodb – SitePoint
Viewing all articles
Browse latest Browse all 37

Create a Movie Recommendation App with Prediction.io – Implementation

$
0
0

In part one, we covered the basics of Prediction IO and installed its dependencies. In this part, we’re going to build the app.

Importing Data from TMDB

We will be importing the data using the Prediction IO SDK, so we first need to tell Flight to use it. In the beginning of your index.php file add the following code:

<?php
session_start(); //start a session
require 'vendor/autoload.php'; //autoload dependencies

use PredictionIO\PredictionIOClient; //import the prediction IO client

Next, register the Prediction IO Client to Flight so that we can use it throughout our app:

Flight::register('prediction', 'PredictionIO\PredictionIOClient');

While we’re here let’s also register the MongoDB class so that we can query MongoDB later on:

Flight::register('mdb', 'Mongo', array('mongodb://localhost'));

Next, we map the factory method to a Flight method and call it prediction_client. We will be using this later on to make calls with the Prediction IO client.

Continue reading %Create a Movie Recommendation App with Prediction.io – Implementation%


Viewing all articles
Browse latest Browse all 37

Trending Articles