public function getSimilarity(array $xVector, array $yVector) { $a = $this->getDotProduct($xVector, $yVector); $b = $this->getNorm($xVector) * $this->getNorm($yVector); if ($b > 0) { return $a / $b; } return 0; }