// candidates generated using the random planner (use the current DA)
if "random" in self.rival_gen_strategy:
random_doc = self.random_candgen.generate_tree(da)
for _ in xrange(self.rival_number - 1):
self.random_candgen.generate_tree(da, random_doc)
rival_ttrees.extend(ttrees_from_doc(random_doc, self.language, self.selector))
rival_feats.extend([self.vectorizer.transform(self.feats.get_features(ttree, {"da": da}))
for ttree in rival_ttrees])
After Change
== train_ttrees[gold_ttree_no]): // don"t generate trees identical to the gold one
del random_doc.bundles[-1]
random_ttrees = ttrees_from_doc(random_doc, self.language, self.selector)
rival_ttrees.extend(random_ttrees)
rival_feats.extend([self.vectorizer.transform(self.feats.get_features(ttree, {"da": da}))
for ttree in random_ttrees])
// return all resulting candidates