Yields the Frobenius matrix norm (cached). n = the square root of the sum of the absolute squares of the values. The matrix norm is used to normalize (0.0-1.0) cosine similarity between documents.
(self)
| 630 | |
| 631 | @property |
| 632 | def l2_norm(self): |
| 633 | """ Yields the Frobenius matrix norm (cached). |
| 634 | n = the square root of the sum of the absolute squares of the values. |
| 635 | The matrix norm is used to normalize (0.0-1.0) cosine similarity between documents. |
| 636 | """ |
| 637 | if self._norm is None: |
| 638 | self._norm = sum(w * w for w in self.itervalues()) ** 0.5 |
| 639 | return self._norm |
| 640 | |
| 641 | norm = l2 = L2 = L2norm = l2norm = L2_norm = l2_norm |
| 642 |
nothing calls this directly
no test coverage detected