bcc / myrrix-bundle
Myrrix bundle for symfony.
dev-master
2012-12-25 17:27 UTC
Requires
- bcc/myrrix: dev-master
- symfony/framework-bundle: >=2.0,<2.3-dev
This package is not auto-updated.
Last update: 2024-09-14 13:46:00 UTC
README
Myrrix 是基于 Apache Mahout 库 的推荐引擎。如果您还不了解它,应该看看这里 Myrrix 网站。
这个包帮助您与 Rest API 进行接口交互。它建立在 Guzzle 之上。
安装和配置
通过 Composer 获取 Bundle
使用库的最佳方式是通过 Composer。
在命令行中执行
composer require bcc/myrrix-bundle
或者手动将库添加到 composer.json 文件中的依赖项
{
"require": {
"bcc/myrrix-bundle": "*"
}
}
然后安装您的依赖项
composer install
将包添加到您的内核
// app/AppKernel.php public function registerBundles() { return array( // ... new BCC\MyrrixBundle\BCCMyrrixBundle(), // ... ); }
设置配置
您需要在配置中配置您的 Myrrix 端点
# app/config/config.yml
bcc_myrrix:
host: localhost # the myrrix host
port: 8080 # the myrrix port
username: test # the myrrix username
password: 1234 # the myrrix password
启动 Myrrix 服务器实例
在开始之前,不要忘记有一个 Myrrix 服务器实例正在运行。只需下载 .jar 可执行文件 用于服务层并运行它
java -jar myrrix-serving-x.y.jar --localInputDir /path/to/working/dir --port 8080
它将在 8080 端口上运行服务器,并使用 /path/to/working/dir
目录作为后端存储。您可以在 这里 获取更多关于服务器的信息。
使用方法
现在您可以简单获取一个 MyrrixService
实例
$myrrix = $container->get('bcc_myrrix.service'); // Put a user/item assocation, here use #101 as an association of strength 0.5 with item #1000 $myrrix->setPreference(101, 1000, 0.5); // Refresh the index $myrrix->refresh(); // Get a recommendation for user #101 $recommendation = $myrrix->getRecommendation(101); // an array of itemId and strength (example: [[325,0.53],[98,0.499]])
更多服务功能
更多功能包括
- 向多个用户推荐
- 向匿名用户推荐
- 更多类似项目
- 偏好批量插入
- ...
您可以在 MyrrixService.php 文件中获取所有功能的完整列表。