Skip to content
A Myrrix Bundle for Symfony 2.
PHP
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
DependencyInjection Support for username/password Dec 20, 2012
Resources/config Move the service to the lib Dec 20, 2012
.gitignore First commit Dec 17, 2012
BCCMyrrixBundle.php First commit Dec 17, 2012
README.markdown Move the service to the lib Dec 20, 2012
composer.json Update Symfony dependency Dec 25, 2012

README.markdown

Myrrix bundle

Myrrix is a recommendation engine built on Apache Mahout libraries. If you don't know it already, you should have a look here Myrrix website.

This bundle helps you interface with the Rest API. It is build on top of Guzzle.

Installation and configuration

Get the Bundle via Composer

The best way to use the library is via Composer.

Do in the command line:

composer require bcc/myrrix-bundle

Or Manually add the library to your dependencies in the composer.json file:

{
    "require": {
        "bcc/myrrix-bundle": "*"
    }
}

Then install your dependencies:

composer install

Add the bundle to your kernel

// app/AppKernel.php
public function registerBundles()
{
    return array(
        // ...
        new BCC\MyrrixBundle\BCCMyrrixBundle(),
        // ...
    );
}

Set the configuration

You will have to configure your Myrrix endpoint in your configuration:

# 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

Start a Myrrix server instance

Before you start, don't forget to have an instance of the Myrrix server running. Simply download the .jar excecutable for the serving layer and run it:

java -jar myrrix-serving-x.y.jar --localInputDir /path/to/working/dir --port 8080

It will run a server on port 8080 and using the /path/to/working/dir directory as a backing storage. You can get more information about the server here.

Usage

You can now simply get an instance of 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]])

More service functions

More functions include:

  • Recommendation to many users
  • Recommendation to anonymous
  • More similar items
  • Batch insertion of preferences
  • ...

You can get a full list of functions in the MyrrixService.php file.

You can’t perform that action at this time.