2017 © Pedro Peláez
 

library recommendation

Simple recommendation library for small projects

image

filippo-toso/recommendation

Simple recommendation library for small projects

  • Saturday, November 4, 2017
  • by filippo.toso
  • Repository
  • 0 Watchers
  • 1 Stars
  • 7 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Recommendation library

A simple recommendation library for small projects. The SimpleEngine supports only the "liked" action (i.e. Philip likes the Caprese pizza). The BinatyEngine supports both "liked" and "disliked" actions (i.e. Philip likes the Verdure pizza but dislikes the Arrabbiata pizza)., (*1)

Requirements

  • PHP 5.6+

Installing

Use Composer to install it:, (*2)

composer require filippo-toso/recommendation

Using It

use FilippoToso\Recommendation\SimpleEngine;
use FilippoToso\Recommendation\BinaryEngine;

/****************** Simple Engine *********************/

// Creating the recommendation engine
$engine = new SimpleEngine();

// Bulk loading the preferences
$preferences = include(__DIR__) . '/data/simple_preferences.php';
$engine->bulk_load($preferences);

// Returns recommendations only for new elements
$engine->option('new', TRUE);

// Returns recommendations sorted
$engine->option('sort', TRUE);

// Preparing the engine
$engine->prepare();

// How much will Philip like the Diavola pizza?
$result = $engine->liking('Philip', 'Diavola');
printf("Philip liking for the Diavola pizza: %f\r\n", $result);

// Get all the recommended pizzas for Philip
print("Philip recommendations: ");
$result = $engine->recommendations('Philip');

// Display recommendations
print_r($result);

// Get all the recommendations for all the users
$result = $engine->recommendations();

// Display recommendations
print_r($result);

print("\r\n");

/****************** Binary Engine *********************/

// Creating the recommendation engine
$engine = new BinaryEngine();

// Bulk loading the preferences
$preferences = include(__DIR__) . '/data/binary_preferences.php';
$engine->bulk_load($preferences);

// Returns recommendations only for new elements
$engine->option('new', TRUE);

// Returns recommendations sorted
$engine->option('sort', TRUE);

// Preparing the engine
$engine->prepare();

// How much will Philip like the Diavola pizza?
$result = $engine->liking('Philip', 'Diavola');
printf("Philip liking for the Diavola pizza: %f\r\n", $result);

// Get all the recommended pizzas for Philip
print("Philip recommendations: ");
$result = $engine->recommendations('Philip');

// Display recommendations
print_r($result);

// Get all the recommendations for all the users
$result = $engine->recommendations();

// Display recommendations
print_r($result);

The Versions

04/11 2017

dev-master

9999999-dev

Simple recommendation library for small projects

  Sources   Download

MIT

The Requires

  • php ^5.6 || ^7.0

 

by Filippo Toso

04/11 2017

v1.0.2

1.0.2.0

Simple recommendation library for small projects

  Sources   Download

MIT

The Requires

  • php ^5.6 || ^7.0

 

by Filippo Toso

04/11 2017

v1.0.1

1.0.1.0

Simple recommendation library for small projects

  Sources   Download

MIT

The Requires

  • php ^5.6 || ^7.0

 

by Filippo Toso

04/11 2017

v1.0.0

1.0.0.0

Simple recommendation library for small projects

  Sources   Download

MIT

The Requires

  • php ^5.6 || ^7.0

 

by Filippo Toso