getRecommender() public method

public getRecommender ( $name ) : GraphAware\Reco4PHP\Engine\RecommendationEngine
$name
return GraphAware\Reco4PHP\Engine\RecommendationEngine
コード例 #1
0
 public function testRecoForJohn()
 {
     $engine = $this->recoService->getRecommender('find_friends');
     $john = $this->getUserNode('John');
     $recommendations = $engine->recommend($john, new SimpleContext());
     $recommendations->sort();
     $this->assertEquals(2, $recommendations->size());
     $this->assertNull($recommendations->getItemBy('name', 'John'));
     $recoForMarc = $recommendations->getItemBy('name', 'marc');
     $this->assertEquals(1, $recoForMarc->totalScore());
     $recoForBill = $recommendations->getItemBy('name', 'Bill');
     $this->assertEquals(2, $recoForBill->totalScore());
 }
コード例 #2
0
 /**
  * @param int $id
  * @return \GraphAware\Reco4PHP\Result\Recommendations
  */
 public function recommendMovieForUserWithId($id)
 {
     $input = $this->service->findInputBy('User', 'id', $id);
     $recommendationEngine = $this->service->getRecommender("user_movie_reco");
     return $recommendationEngine->recommend($input, new SimpleContext());
 }