mirror of https://github.com/explosion/spaCy.git
Use ftrl optimizer in parser
This commit is contained in:
parent
4cab8ac136
commit
8543db8a5b
|
@ -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]
|
||||
|
|
Loading…
Reference in New Issue