headzoo/prediction-io-bundle

Endroid PredictionIO Bundle for Symfony

1.1.3 2014-11-07 09:31 UTC

This package is not auto-updated.

Last update: 2024-04-23 06:38:54 UTC


README

By endroid

Build Status Latest Stable Version Total Downloads

This bundle provides easy integration with PredictionIO. PredictionIO is an open source machine learning server for software developers to create predictive features, such as personalization, recommendation and content discovery. Based on Apache Mahout scalable machine learning libraries.

The bundle registers the Endroid PredictionIO client as a service in your Symfony project. This client can then be used to register actions between users and items and to retrieve recommendations provided by any PredictionIO server. Applications range from showing recommended products in a web shop to discovering relevant experts in a social collaboration network.

knpbundles.com

Requirements

Installation

Add in your composer.json

{
    "require": {
        "endroid/prediction-io-bundle": "dev-master"
    }
}

Install the bundle

$ curl -s http://getcomposer.org/installer | php
$ php composer.phar update endroid/prediction-io-bundle

Composer will install the bundle to your project's vendor/endroid directory.

Enable the bundle via the kernel

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Endroid\Bundle\PredictionIOBundle\EndroidPredictionIOBundle(),
    );
}

Configuration

config.yml

endroid_prediction_io:
    app_key: "Your app key"
    api_url: "http://localhost:8000" // optional

Usage

After installation and configuration, the service can be directly referenced from within your controllers.

<?php
public function recommendAction()
{
    $client = $this->get('endroid.prediction_io');

    // populate
    $client->createUser($userId);
    $client->createItem($itemId);
    $client->recordAction($userId, $itemId, 'view');

    // get recommendations and similar items
    $recommendations = $client->getRecommendations($userId, $engine, $count);
    $similarItems = $client->getSimilarItems($itemId, $engine, $count);
}

Vagrant box

PredictionIO provides a Vagrant box containing an out-of-the-box PredictionIO server.

License

This bundle is under the MIT license. For the full copyright and license information, please view the LICENSE file that was distributed with this source code.