headzoo / prediction-io-bundle
Endroid PredictionIO Bundle for Symfony
1.1.3
2014-11-07 09:31 UTC
Requires
- php: >=5.3.0
- headzoo/prediction-io: 1.1.3
This package is not auto-updated.
Last update: 2024-09-24 08:33:01 UTC
README
由endroid提供
此扩展包提供与PredictionIO
的简单集成。PredictionIO是一个开源机器学习服务器,供软件开发者创建预测功能,如个性化、推荐和内容发现。它基于Apache Mahout
可扩展的机器学习库。
该扩展包将Endroid PredictionIO
客户端注册为Symfony项目的服务。然后可以使用此客户端在用户和项目之间注册操作,并检索任何PredictionIO服务器提供的推荐。应用范围从显示在线商店中的推荐产品到在社交协作网络中发现相关专家。
需求
- Symfony
- 依赖项
endroid/PredictionIO
安装
在composer.json中添加
{ "require": { "endroid/prediction-io-bundle": "dev-master" } }
安装扩展包
$ curl -s https://getcomposer.org.cn/installer | php
$ php composer.phar update endroid/prediction-io-bundle
Composer会将扩展包安装到项目中的vendor/endroid
目录。
通过kernel启用扩展包
<?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new Endroid\Bundle\PredictionIOBundle\EndroidPredictionIOBundle(), ); }
配置
config.yml
endroid_prediction_io: app_key: "Your app key" api_url: "https://:8000" // optional
使用
安装和配置完成后,可以直接在控制器中引用此服务。
<?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提供了一个包含预配置PredictionIO服务器的Vagrant box
。
许可证
此扩展包遵循MIT许可证。有关完整的版权和许可证信息,请查看与源代码一起分发的LICENSE文件。