sourcecode/scoring/explanation_tags.py [45:66]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    negativeTags = -1 * filteredTags.to_numpy(dtype=np.float64)

    # Create a small value for tie-breaking, proportional to the column indices
    # The small value should be smaller than the smallest difference between any two elements (ints)
    epsilon = 1e-3
    tieBreakers = np.arange(negativeTags.shape[1]) * epsilon

    # Add the tie_breaker to the array
    negativeTieBrokenTags = tieBreakers + negativeTags

    # Fill nans with 0 (higher than all other values with nonzero tag counts)
    negativeTieBrokenTags = np.nan_to_num(negativeTieBrokenTags)

    # Use argsort on the modified array
    sortedIndices = np.argsort(negativeTieBrokenTags, axis=1)

    # Extract indices of the two largest values in each row
    topTwoIndices = sortedIndices[:, :2]
    noteTopTags = pd.DataFrame(
      np.array(filteredTags.columns)[topTwoIndices], columns=[c.firstTagKey, c.secondTagKey]
    )
    noteTopTags[c.noteIdKey] = filteredTags.index
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



sourcecode/scoring/explanation_tags.py [101:122]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    negativeTags = -1 * filteredTags.to_numpy(dtype=np.float64)

    # Create a small value for tie-breaking, proportional to the column indices
    # The small value should be smaller than the smallest difference between any two elements (ints)
    epsilon = 1e-3
    tieBreakers = np.arange(negativeTags.shape[1]) * epsilon

    # Add the tie_breaker to the array
    negativeTieBrokenTags = tieBreakers + negativeTags

    # Fill nans with 0 (higher than all other values with nonzero tag counts)
    negativeTieBrokenTags = np.nan_to_num(negativeTieBrokenTags)

    # Use argsort on the modified array
    sortedIndices = np.argsort(negativeTieBrokenTags, axis=1)

    # Extract indices of the two largest values in each row
    topTwoIndices = sortedIndices[:, :2]
    noteTopTags = pd.DataFrame(
      np.array(filteredTags.columns)[topTwoIndices], columns=[c.firstTagKey, c.secondTagKey]
    )
    noteTopTags[c.noteIdKey] = filteredTags.index
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



