mirror of
https://github.com/explosion/spaCy.git
synced 2025-05-02 23:03:41 +03:00
* Add comment about zipf reweighting
This commit is contained in:
parent
4d37b66c55
commit
0eec1d12af
|
@ -47,6 +47,9 @@ cdef class Model:
|
||||||
@cython.cdivision
|
@cython.cdivision
|
||||||
@cython.boundscheck(False)
|
@cython.boundscheck(False)
|
||||||
cdef int regularize(self, Feature* feats, int n, int a=3) except -1:
|
cdef int regularize(self, Feature* feats, int n, int a=3) except -1:
|
||||||
|
# Use the Zipfian corruptions technique from here:
|
||||||
|
# http://www.aclweb.org/anthology/N13-1077
|
||||||
|
# This seems good for 0.1 - 0.3 % on OOD data.
|
||||||
cdef int i
|
cdef int i
|
||||||
cdef long[:] zipfs = numpy.random.zipf(a, n)
|
cdef long[:] zipfs = numpy.random.zipf(a, n)
|
||||||
for i in range(n):
|
for i in range(n):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user