mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-27 02:16:32 +03:00
Fix regression on cost
This commit is contained in:
parent
1a1b2f9174
commit
b73295557c
|
@ -43,9 +43,8 @@ cdef class ParserPerceptron(AveragedPerceptron):
|
||||||
continue
|
continue
|
||||||
loss += (-eg.c.costs[clas] - eg.c.scores[clas]) ** 2
|
loss += (-eg.c.costs[clas] - eg.c.scores[clas]) ** 2
|
||||||
d_loss = 2 * (-eg.c.costs[clas] - eg.c.scores[clas])
|
d_loss = 2 * (-eg.c.costs[clas] - eg.c.scores[clas])
|
||||||
step = d_loss * 0.001
|
|
||||||
for feat in eg.c.features[:eg.c.nr_feat]:
|
for feat in eg.c.features[:eg.c.nr_feat]:
|
||||||
self.update_weight(feat.key, clas, feat.value * step)
|
self.update_weight(feat.key, clas, feat.value * -d_loss)
|
||||||
return int(loss)
|
return int(loss)
|
||||||
|
|
||||||
cdef int set_featuresC(self, FeatureC* feats, const void* _state) nogil:
|
cdef int set_featuresC(self, FeatureC* feats, const void* _state) nogil:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user