From 8543db8a5b27244b71b4bb3285efe5eea04f7352 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Wed, 15 Mar 2017 11:56:37 -0500 Subject: [PATCH] Use ftrl optimizer in parser --- spacy/syntax/parser.pyx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spacy/syntax/parser.pyx b/spacy/syntax/parser.pyx index 3f8571913..944bc4442 100644 --- a/spacy/syntax/parser.pyx +++ b/spacy/syntax/parser.pyx @@ -87,8 +87,8 @@ cdef class ParserModel(AveragedPerceptron): if guess == best or best == -1: return 0.0 for feat in eg.c.features[:eg.c.nr_feat]: - self.update_weight(feat.key, guess, feat.value * eg.c.costs[guess]) - self.update_weight(feat.key, best, -feat.value * eg.c.costs[guess]) + self.update_weight_ftrl(feat.key, guess, feat.value * eg.c.costs[guess]) + self.update_weight_ftrl(feat.key, best, -feat.value * eg.c.costs[guess]) #for clas in [guess, best]: # loss += (-eg.c.costs[clas] - eg.c.scores[clas]) ** 2 # d_loss = eg.c.scores[clas] - -eg.c.costs[clas]