capreolus.extractor.slowembedtext

Module Contents

Classes

SlowEmbedText(config=None, provide=None, share_dependency_objects=False, build=True) Base class for Extractor modules. The purpose of an Extractor is to convert queries and documents to a representation suitable for use with a Reranker module.
capreolus.extractor.slowembedtext.logger[source]
class capreolus.extractor.slowembedtext.SlowEmbedText(config=None, provide=None, share_dependency_objects=False, build=True)[source]

Bases: capreolus.extractor.Extractor

Base class for Extractor modules. The purpose of an Extractor is to convert queries and documents to a representation suitable for use with a Reranker module.

Modules should provide:
  • an id2vec(qid, posid, negid=None) method that converts the given query and document ids to an appropriate representation
module_name = slowembedtext[source]
requires_random_seed = True[source]
dependencies[source]
config_spec[source]
pad = 0[source]
pad_tok = <pad>[source]
load_state(self, qids, docids)[source]
cache_state(self, qids, docids)[source]
get_tf_feature_description(self)[source]
create_tf_train_feature(self, sample)[source]

sample - output from self.id2vec() return - a tensorflow feature

create_tf_dev_feature(self, sample)[source]
parse_tf_train_example(self, example_proto)[source]
parse_tf_dev_example(self, example_proto)[source]
exist(self)[source]
preprocess(self, qids, docids, topics)[source]
id2vec(self, qid, posid, negid=None, label=None)[source]

Creates a feature from the (qid, docid) pair. If negdocid is supplied, that’s also included in the feature (needed for training with pairwise hinge loss) Label is a vector of shape [num_classes], and is supplied only when using pointwise training (i.e cross entropy) When using pointwise samples, negdocid is None, and label is either [0, 1] or [1, 0] depending on whether the document represented by posdocid is relevant or irrelevant respectively.