capreolus.reranker

Submodules

Package Contents

Classes

Reranker

Base class for Reranker modules. The purpose of a Reranker is to predict relevance scores for input documents. Rerankers are generally supervised methods implemented in PyTorch or TensorFlow.

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

Bases: capreolus.ModuleBase

Base class for Reranker modules. The purpose of a Reranker is to predict relevance scores for input documents. Rerankers are generally supervised methods implemented in PyTorch or TensorFlow.

Modules should provide:
  • a build_model method that initializes the model used

  • a score and a test method that take a representation created by an Extractor module as input and return document scores

  • a load_weights and a save_weights method, if the base class’ PyTorch methods cannot be used

module_type = reranker[source]
dependencies[source]
add_summary(self, summary_writer, niter)[source]

Write to the summay_writer custom visualizations/data specific to this reranker

save_weights(self, weights_fn, optimizer)[source]
load_weights(self, weights_fn, optimizer)[source]