create() public static method

public static create ( string $uri ) : RecommenderService
$uri string
return RecommenderService
 /**
  * @setUp()
  */
 public function setUp()
 {
     $this->recoService = RecommenderService::create('http://localhost:7474');
     $this->recoService->registerRecommendationEngine(new RecoEngine());
     $this->client = ClientBuilder::create()->addConnection('default', 'http://localhost:7474')->build();
     $this->createGraph();
 }
 /**
  * ExampleRecommenderService constructor.
  * @param string $databaseUri
  */
 public function __construct($databaseUri)
 {
     $this->service = RecommenderService::create($databaseUri);
     $this->service->registerRecommendationEngine(new ExampleRecommendationEngine());
 }
Esempio n. 3
0
<?php

require_once __DIR__ . '/vendor/autoload.php';
$rs = \GraphAware\Reco4PHP\RecommenderService::create("http://*****:*****@localhost:7474");
$rs->registerRecommendationEngine(new \GraphAware\Reco4PHP\Tests\Example\ExampleRecommendationEngine());
$input = $rs->findInputBy('User', 'id', 460);
$engine = $rs->getRecommender("example");
$recommendations = $engine->recommend($input);
echo $recommendations->size();
Esempio n. 4
0
<?php

require_once __DIR__ . '/vendor/autoload.php';
use GraphAware\Reco4PHP\Demo\Github\RecommendationEngine;
use GraphAware\Reco4PHP\RecommenderService;
$rs = RecommenderService::create("http://localhost:7474");
$rs->registerRecommendationEngine(new RecommendationEngine());
$stopwatch = new \Symfony\Component\Stopwatch\Stopwatch();
$input = $rs->findInputBy('User', 'login', 'jakzal');
$engine = $rs->getRecommender("github_who_to_follow");
$stopwatch->start('reco');
$recommendations = $engine->recommend($input);
$e = $stopwatch->stop('reco');
//echo $recommendations->size() . ' found in ' . $e->getDuration() .  'ms' .PHP_EOL;
foreach ($recommendations->getItems(10) as $reco) {
    echo $reco->item()->get('login') . PHP_EOL;
    echo $reco->totalScore() . PHP_EOL;
    foreach ($reco->getScores() as $name => $score) {
        echo "\t" . $name . ':' . $score->score() . PHP_EOL;
    }
}