public function Recommender::topPrediction in Recommender API 6.2
File
- ./
Recommender.php, line 439
Class
- Recommender
- The super class for all other Recommender algorithms.
Code
public function topPrediction($mouse, $topN, $testFunc = NULL) {
$list = array();
$result = db_query_range("SELECT cheese_id id, prediction score FROM {recommender_prediction}\n WHERE app_id=%d AND mouse_id=%d\n ORDER BY prediction DESC, created DESC, mouse_id ASC", $this->appId, $mouse, 0, TOP_N_LIMIT);
while (($item = db_fetch_array($result)) && count($list) < $topN) {
if ($testFunc === NULL || call_user_func($testFunc, $item)) {
$list[] = $item;
}
}
return $list;
}