util
sparse_inverse_nonzero(a) ¶
Invert nonzero elements of a scipy.sparse.csr_matrix.
:param a: Matrix to invert. :type a: csr_matrix :return: Matrix with nonzero elements inverted. :rtype: csr_matrix
Source code in src/recnexteval/metrics/core/util.py
4 5 6 7 8 9 10 11 12 13 14 | |
sparse_divide_nonzero(a, b) ¶
Elementwise divide of nonzero elements of a by nonzero elements of b.
Elements that were zero in either a or b are zero in the resulting matrix.
:param a: Numerator. :type a: csr_matrix :param b: Denominator. :type b: csr_matrix :return: Result of the elementwise division of matrix a by matrix b. :rtype: csr_matrix
Source code in src/recnexteval/metrics/core/util.py
17 18 19 20 21 22 23 24 25 26 27 28 29 | |