torcharrow.functional.get_score_sum¶
- torcharrow.functional.get_score_sum(input_ids: ListColumn, input_id_scores: ListColumn, matching_ids: ListColumn, matching_id_scores: ListColumn)¶
Return the sum of all the scores in matching_id_scores that has a corresponding id in matching_ids that is also in input_ids. :param input_ids: :type input_ids: First list of ids :param input_ids_scores: :type input_ids_scores: scores (weights) of input_ids :param matching_ids: :type matching_ids: Second list of ids :param matching_ids_scores: :type matching_ids_scores: scores (weights) of matching_ids
Examples
>>> import torcharrow as ta >>> from torcharrow import functional >>> input_ids = ta.column([[1, 2, 3]]) >>> input_id_scores = ta.column([[1.0,2.0,3.0]]) >>> matching_ids = ta.column([[1,2]]) >>> matching_id_scores = ta.column([[5.0,4.0]]) >>> functional.get_score_sum(input_ids, input_id_scores, matching_ids, matching_id_scores) 0 9 dtype: Float32(nullable=True), length: 1, null_count: 0