By endroid
The Endroid 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.
- Symfony
- Dependencies:
PredictionIO-PHP-SDK
Use Composer to install the library.
$ composer require endroid/prediction-io<?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);PredictionIO provides a Vagrant box
containing an out-of-the-box PredictionIO server.
You can use EndroidPredictionIOBundle
to enable this service in your Symfony application.
Semantic versioning (semver) is applied.
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.