endroid/prediction-io

Endroid PredictionIO Client

Installs: 1 956

Dependents: 1

Stars: 8

Watchers: 2

Forks: 7

Language: PHP

2.0.3 2015-07-04 20:10 UTC

README

By endroid

Build Status Latest Stable Version Total Downloads License

The PredictionIO library provides a client which offers easy access to a PredictionIO recommendation engine. PredictionIO is an open source machine learning server for software developers to create predictive features, such as personalization, recommendation and content discovery.

Through a small set of simple calls, all server functionality is exposed to your application. You can add users and items, register actions between these users and items and retrieve recommendations deduced from this information by any PredictionIO recommendation engine. Applications range from showing recommended products in a web shop to discovering relevant experts in a social collaboration network.

Requirements

Installation

Use Composer to install the library.

$ composer require endroid/prediction-io

Usage

<?php

use Endroid\PredictionIO\EventClient;
use Endroid\PredictionIO\EngineClient;

$eventClient = new EventClient($apiKey, $eventServerUrl);
$engineClient = new EngineClient($engineUrl);

// Populate with users and items
$userProperties = ['address' => '1234 Street, San Francisco, CA 94107', 'birthday' => '22-04-1991'];
$eventClient->createUser($userId, $userProperties);
$itemProperties = ['categories' => [123, 1234, 12345]];
$eventClient->createItem($itemId, $itemProperties);

// Record actions
$actionProperties = ['firstView' => true];
$eventClient->recordUserActionOnItem('view', $userId, $itemId, $actionProperties);

// Return recommendations
$itemCount = 20;
$recommendedItems = $engineClient->getRecommendedItems($userId, $itemCount);
$similarItems = $engineClient->getSimilarItems($itemId, $itemCount);

Vagrant box

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

Symfony

You can use EndroidPredictionIOBundle to enable this service in your Symfony application.

Versioning

Semantic versioning (semver) is applied as much as possible.

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.