def __init__(self, path, normalize=True, eig=0.0, transpose=False):
if transpose:
ut = np.load(path + '.vt.npy')
self.wi, self.iw = load_vocabulary(path + '.contexts.vocab')
else:
ut = np.load(path + '.ut.npy')
self.wi, self.iw = load_vocabulary(path + '.words.vocab')
s = np.load(path + '.s.npy')
if eig == 0.0:
self.m = ut.T
elif eig == 1.0:
self.m = s * ut.T
else:
self.m = np.power(s, eig) * ut.T
self.dim = self.m.shape[1]
if normalize:
self.normalize()
评论列表
文章目录