function SparseVector::covariance in Recommender API 7.6
Same name and namespace in other branches
- 6.2 Matrix.php \SparseVector::covariance()
Compute covariance with $vector. No caching option. Works for RealVector. SparseVector needs additional handling.
Parameters
$vector it has to be the same type (either SparseVector or RealVector) as $this:
Return value
covariance value
Overrides Vector::covariance
File
- classes/
Matrix.php, line 318
Class
- SparseVector
- Sparse Vector takes care of missing data.
Code
function covariance(&$vector) {
$subset = $this
->common_items($vector);
return $subset === NULL ? NAN : $subset[0]
->covariance($subset[1]);
}