From 0a4b074184d7cd3f143a5d80597c7bb099f7a8b6 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Sun, 17 Mar 2019 21:47:45 +0100 Subject: [PATCH] Improve beam search defaults --- spacy/syntax/nn_parser.pyx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spacy/syntax/nn_parser.pyx b/spacy/syntax/nn_parser.pyx index f7938d0a4..177340703 100644 --- a/spacy/syntax/nn_parser.pyx +++ b/spacy/syntax/nn_parser.pyx @@ -402,11 +402,11 @@ cdef class Parser: multitask.update(docs, golds, drop=drop, sgd=sgd) # The probability we use beam update, instead of falling back to # a greedy update - beam_update_prob = self.cfg.get('beam_update_prob', 1.0) + beam_update_prob = self.cfg.get('beam_update_prob', 0.5) if self.cfg.get('beam_width', 1) >= 2 and numpy.random.random() < beam_update_prob: return self.update_beam(docs, golds, self.cfg.get('beam_width', 1), drop=drop, sgd=sgd, losses=losses, - beam_density=self.cfg.get('beam_density', 0.0)) + beam_density=self.cfg.get('beam_density', 0.001)) # Chop sequences into lengths of this many transitions, to make the # batch uniform length. cut_gold = numpy.random.choice(range(20, 100))