π¨βπ»
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import defaultdict | |
def reciprocal_rank_fusion(*list_of_list_ranks_system, K=60): | |
""" | |
Fuse rank from multiple IR systems using Reciprocal Rank Fusion. | |
Args: | |
* list_of_list_ranks_system: Ranked results from different IR system. | |
K (int): A constant used in the RRF formula (default is 60). | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import torch.nn | |
import collections | |
class Builder(object): | |
def __init__(self, *namespaces): | |
self._namespace = collections.ChainMap(*namespaces) | |
def __call__(self, name, *args, **kwargs): | |
try: | |
return self._namespace[name](*args, **kwargs) |