tag | 7257065a66c93b522d78a9730317eed546f6886f | |
---|---|---|
tagger | Donald Szeto <donald@tappingstone.com> | Sat Feb 02 00:14:26 2013 +0800 |
object | 979ca7c969323503930900949a53859fe55478ea |
Version 0.1
commit | 979ca7c969323503930900949a53859fe55478ea | [log] [tgz] |
---|---|---|
author | Donald Szeto <donald@tappingstone.com> | Fri Feb 01 21:01:32 2013 +0800 |
committer | Donald Szeto <donald@tappingstone.com> | Fri Feb 01 21:01:32 2013 +0800 |
tree | b3ab1b4934b61f5c11906f015baa643960ef47b0 | |
parent | 105ae052d83809f6812eea10336ca9f14af92f5c [diff] |
Add license
PredictionIO is a prediction server for building smart applications. While you search data through a database server, you can make prediction through PredictionIO.
With PredictionIO, you can write apps
Detailed documentation will be available on our wiki page.
The current default PredictionIO setup assumes that you have the following installed and configured in a trusted environment:
Simply clone PredictionIO to your local machine. The following steps assume that you have cloned the repo at your home directory.
cd ~ git clone git://github.com/PredictionIO/PredictionIO.git
Compile dependencies first using sbt.
cd ~/PredictionIO/commons sbt +publish cd ~/PredictionIO/output sbt +publish
Compile and build a process assembly using sbt, where >
indicates commands that will be run in the sbt console.
cd ~/PredictionIO/process/hadoop/scala sbt > project scala-assembly > assembly
Compile and pack the command line user administration tool. The default configuration assumes that you are running MongoDB at localhost:27017. If this is not the case, update the configuration in ~/PredictionIO/tools/users/src/main/resources/application.conf
before compiling.
io.prediction.commons.settings.db.type=mongodb io.prediction.commons.settings.db.host=your.host.com io.prediction.commons.settings.db.port=12345
After that, compile the tool.
cd ~/PredictionIO/tools/users sbt pack
You must add at least one user to be able to log in. Run
~/PredictionIO/tools/users/target/pack/bin/users
and follow the on-screen instructions to create a user.
Similar to the CLI tool, you may want to change your configuration, which is located at ~/PredictionIO/adminServer/conf/application.conf
Notice that the commons settings database should be the same as the one specified in the CLI tool.
Assuming you have installed the Play framework at /opt/play, where >
indicates commands that will be run in the Play console.
cd ~/PredictionIO/adminServer /opt/play/play > update > compile > run
To access the admin panel, point your browser to http://localhost:9000/. After the first run, you may skip update
and compile
.
Again, change the configuration in ~/PredictionIO/output/api/conf/application.conf
where you see fit. With the same assumption from the step before,
cd ~/PredictionIO/output/api /opt/play/play > update > compile > run 8000
This will start the API server on the default port 8000.
Change the configuration in ~PredictionIO/scheduler/conf/application.conf
where you see fit.
In this configuration, however, you may want to change all database host names to one that can be resolved by all nodes in your Hadoop farm.
With the same assumption from the step before,
cd ~/PredictionIO/scheduler /opt/play/play > update > compile > run 7000
This will start the scheduler on the default port 7000.
In this tutorial, we are building a unique recommendation engine on PredictionIO for a restaurant discovery app. Sign into PredictionIO web admin panel using the administrator account you have created during installation. Then follow these 5 steps:
In the Applications page, add a new app by giving it a name, e.g. ‘My Restaurant App’, and click Create.
Click Develop on ‘My Restaurant App’, and you will find the App Key. This is the information you need when you integrate your app with PredictionIO SDKs later.
Click Add an Engine. You will see the available engine types of PredictionIO. In this example, we want to use ‘Item Recommendation Engine’ which can predict user preferences for items. In our case, restaurants are the items.
Give your new engine a name, e.g. ‘restaurant-rec’, and click Create.
Now you have a working recommendation engine. You can start using it right away! If you can spare another minute with us, see how you can fine-tune this engine in ‘Adjust Prediction Settings’ (Step 4). Otherwise, skip to ‘Start Using the Engine’ (Step 5).
After your first engine is created, you will arrive at the Prediction Settings page.
Item Types Settings
Here, you can define which types of items, i.e. Item Types, this engine should handle.
With our example, we may assign a single item type ‘restaurant’ to all restaurants. But other item types such as ‘cafe’, ‘bar’, ‘fast-food’, ‘casual’ and ‘fine-dining’ may be assigned to individual restaurants.
If you want to this engine to only handle ‘fast-food’ and ‘casual’ types of restaurants, you should add ‘fast-food’ and ‘casual’ in the Item Types Settings area.
By default, an Item Recommendation Engine would “Include ALL item types”.
Recommendation Preferences
Recommendation preferences of different applications vary. For a newsfeed application or a group buying site, it is more desirable to recommend new items to users; for our example of restaurant discovery app, you may not always need to recommend the newest restaurants. You can fine-tune this engine in the Recommendation Preferences area.
Recommendation Goal
You can adjust what to optimize with this engine in this area.
Ruby SDK is used in examples below.
client = PredictionIO::Client.new(<appkey>)
Import your Data
Import your users, items and behaviors data into ‘My Restaurant App’ through the API key that you have obtained:
Add User
client.acreate_user(<username>)
Add Item (restaurant)
client.acreate_item(<itemname>, <array_of_item_types>)
Add Behavior
client.auser_rate_item(<username>, <itemname>, <rating_from_1_to_5>)
Note 1: Item Recommendation Engine uses previous user behavior data to predict users’ future preferences.
Note 2: The data you import into ‘My Restaurant App’ will be shared among all engines you create.
Retrieve Prediction
Item Recommendation Engine is trained/re-trained with new data every day.
To predict top N restaurants that a user may like:
client.get_itemrec_top_n(<enginename>, <username>, <N>)
Item Recommendation Engine also supports location-based and item validity scenario. Please refer to the wiki for more information.
An Algorithms tab can be found next to the Prediction Settings tab. This is the place where you can fine-tune the underlying algorithm of the engine.
PredictionIO source files are made available under the terms of the GNU Affero General Public License (AGPL).