By endroid
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.
- Symfony
- Dependencies:
endroid/PredictionIO
Use Composer to install the bundle.
$ composer require endroid/prediction-io-bundleThen enable the bundle via the kernel.
<?php
// app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
new Endroid\Bundle\PredictionIOBundle\EndroidPredictionIOBundle(),
);
}endroid_prediction_io:
eventServer:
url: %prediction_io.eventServer.url%
apps:
yashry:
key: %prediction_io.yashry.key%
engines:
complementarypurchase:
url: http://localhost:8000
productranking:
url: http://localhost:8001
viewedthenbought:
url: http://localhost:8002
recommendation:
url: http://localhost:8003
similarproduct:
url: http://localhost:8004
leadscoring:
url: http://localhost:8005
edfa3ly:
key: %prediction_io.edfa3ly.key%
engines:
complementarypurchase:
url: http://localhost:8006
leadscoring:
url: http://localhost:8007After installation and configuration, the client can be directly referenced from within your controllers.
<?php
use Endroid\PredictionIO\EventClient;
use Endroid\PredictionIO\EngineClient;
/** @var EventClient $yashryEventClient */
$yashryEventClient = $this->get('endroid.prediction_io.yashry.event_client');
/** @var EngineClient $yashryRecommendationEngineClient */
$yashryRecommendationEngineClient = $this->get('endroid.prediction_io.yashry.recommendation.engine_client');
/** @var EngineClient $yashrySimilarProductEngineClient */
$yashrySimilarProductEngineClient = $this->get('endroid.prediction_io.yashry.similarproduct.engine_client');
// Populate with users and items
$yashryEventClient->createUser($userId);
$yashryEventClient->createItem($itemId);
// Record actions
$client->recordUserActionOnItem('view', $userId, $itemId);
// Return recommendations
$recommendedItems = $yashryRecommendationEngineClient->getRecommendedItems($userId, $itemCount);
$similarItems = $yashrySimilarProductEngineClient->getSimilarItems($itemId, $itemCount);PredictionIO provides a Vagrant box
containing an out-of-the-box PredictionIO server.
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.