utils
get_top_K_ranks(X, K=None) ¶
Returns a matrix of ranks assigned to the largest K values in X.
Selects K largest values for every row in X and assigns a rank to each.
:param X: Matrix from which we will select K values in every row. :type X: csr_matrix :param K: Amount of values to select. :type K: int, optional :return: Matrix with K values per row. :rtype: csr_matrix
Source code in src/streamsight/algorithms/utils.py
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | |
get_top_K_values(X, K=None) ¶
Returns a matrix of only the K largest values for every row in X.
Selects the top-K items for every user (which is equal to the K nearest neighbours.) In case of a tie for the last position, the item with the largest index of the tied items is used.
:param X: Matrix from which we will select K values in every row. :type X: csr_matrix :param K: Amount of values to select. :type K: int, optional :return: Matrix with K values per row. :rtype: csr_matrix
Source code in src/streamsight/algorithms/utils.py
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | |