You are here

public function Recommender::retrieveSimilarity in Recommender API 6.2

Return the similarity between $mouse1 and $mouse2.

Parameters

$mouse1:

$mouse2:

Return value

float similarity score for $mouse1 and $mouse2; return NAN if error

File

./Recommender.php, line 404

Class

Recommender
The super class for all other Recommender algorithms.

Code

public function retrieveSimilarity($mouse1, $mouse2) {
  $result = @db_query("SELECT similarity FROM {recommender_similarity}\n                WHERE app_id=%d AND mouse1_id=%d AND mouse2_id=%d", $this->appId, $mouse1, $mouse2);
  $similarity = db_result($result);

  // return FALSE or NULL could be confused with 0. Therefore, return NAN for error cases.
  return $similarity !== FALSE ? $similarity : NAN;
}