capreolus.reranker.TFKNRM

Module Contents

Classes

TFKNRM_Class(extractor, config, **kwargs)
TFKNRM(config=None, provide=None, share_dependency_objects=False, build=True) TensorFlow implementation of KNRM.
class capreolus.reranker.TFKNRM.TFKNRM_Class(extractor, config, **kwargs)[source]

Bases: tensorflow.keras.Model

get_score(self, doc_tok, query_tok, query_idf)[source]
call(self, x, **kwargs)[source]

During training, both posdoc and negdoc are passed During eval, both posdoc and negdoc are passed but negdoc would be a zero tensor Whether negdoc is a legit doc tensor or a dummy zero tensor is determined by which sampler is used (eg: sampler.TrainDataset) as well as the extractor (eg: EmbedText)

Unlike the pytorch KNRM model, KNRMTF accepts both the positive and negative document in its forward pass. It scores them separately and returns the score difference (i.e posdoc_score - negdoc_score).

class capreolus.reranker.TFKNRM.TFKNRM(config=None, provide=None, share_dependency_objects=False, build=True)[source]

Bases: capreolus.reranker.Reranker

TensorFlow implementation of KNRM.

Chenyan Xiong, Zhuyun Dai, Jamie Callan, Zhiyuan Liu, and Russell Power. 2017. End-to-End Neural Ad-hoc Ranking with Kernel Pooling. In SIGIR‘17.

module_name = TFKNRM[source]
dependencies[source]
config_spec[source]
build_model(self)[source]