def convert_glove_to_w2v(): infile = '/root/cove/test/.vector_cache/glove.6B.100d.txt' outfile = '/root/w266_final/data/glove.6B.100d.txt' glove2word2vec(infile, outfile) return word2vec.Model('glove6B', 'cosine', d=100, fname='glove.6B.100d.txt', binary=False)
def main(): if len(sys.argv) == 2: if sys.argv[1] == 'c': dist = 'cosine' elif sys.argv[1] == 'e': dist = 'euclidean' else: dist = 'euclidean' m = word2vec.Model('word2vec', dist_metric=dist, d=50) score_model(m)
def main(): ''' ''' dist = 'cosine' print('Testing acc on custom word2vec vectors') m = word2vec.Model('custw2v', dist_metric='cosine', d=300, fname='short_w2v.txt', binary=False) score_model(m)
def main(): ''' System arguments: 1 = Filename of model 2 = Distance metric: e = euclidean; c = cosine ''' fname = sys.argv[1] if sys.argv[2] == 'c': dist = 'cosine' elif sys.argv[2] == 'e': dist = 'euclidean' m = word2vec.Model('', dist_metric=dist, fname=fname, binary=False) acc = score_model(m)
def main(): ''' System arguments: 1 = # of dimensions for GloVe model 2 = Distance metric: e = euclidean; c = cosine ''' dist = 'cosine' print('Testing acc on custom glove vectors') m = word2vec.Model('custglove', dist_metric='cosine', d=300, fname='custom_glove_embed_w2v.txt', data_dir='/root/w266_final/data', binary=False) score_model(m)
def main(): ''' System arguments: 1 = # of dimensions for GloVe model 2 = Distance metric: e = euclidean; c = cosine ''' if len(sys.argv) == 3: d_in = sys.argv[1] if sys.argv[2] == 'c': dist = 'cosine' elif sys.argv[2] == 'e': dist = 'euclidean' else: d_in = 50 dist = 'euclidean' print("Running GloVe model with d=", d_in, 'Dist metric=', dist) m = word2vec.Model('glove', dist_metric=dist, d=d_in) score_model(m)