// Subtract the mean so that vectors don"t just clump around common
// hypernyms
orig_vecs -= orig_vecs.mean(0)
// Delete the frame we built, we won"t need its indices again until the end
del retroframe
vecs = orig_vecs
for iteration in range(iterations):
if verbosity >= 1:
print("Retrofitting: Iteration %s of %s" % (iteration+1, iterations))
vecs = sparse_csr.dot(vecs)
vecs -= vecs.mean(0)
// use sklearn"s normalize, because it normalizes in place and
// leaves zero-rows at 0
normalize(vecs, norm="l2", copy=False)