In [1]:
%load_ext autoreload
%autoreload 2
In [2]:
import word2vec
In [3]:
import numpy as np
In [4]:
model = word2vec.load('/Users/danielfrg/Downloads/text8.bin')
In [5]:
%%timeit
indexes, metrics = model.cosine('word', n=10)
In [6]:
%%timeit
indexes, metrics = model.cosine('socks', n=10)
model.generate_response(indexes, metrics)
In [7]:
%%timeit
indexes, metrics = model.cosine('word', n=5000)
In [8]:
%%timeit
indexes, metrics = model.cosine('word', n=5000)
model.generate_response(indexes, metrics)
In [9]:
%%timeit
indexes, metrics = model.analogy(pos=['paris', 'germany'], neg=['france'], n=10)
In [10]:
%%timeit
indexes, metrics = model.analogy(pos=['paris', 'germany'], neg=['france'], n=10)
model.generate_response(indexes, metrics)
In [11]:
%%timeit
indexes, metrics = model.analogy(pos=['paris', 'germany'], neg=['france'], n=5000)
In [12]:
%%timeit
indexes, metrics = model.analogy(pos=['paris', 'germany'], neg=['france'], n=5000)
model.generate_response(indexes, metrics)
In [13]:
%%timeit
indexes, metrics = model.analogy(pos=['paris', 'germany'], neg=['france'], n=5000)
model.generate_response(indexes, metrics).tolist()
In [14]:
clusters = word2vec.load_clusters('/Users/danielfrg/Downloads/text8-clusters.txt')
In [15]:
model.clusters = clusters
In [16]:
%%timeit
indexes, metrics = model.analogy(pos=['paris', 'germany'], neg=['france'], n=10)
model.generate_response(indexes, metrics)
In [17]:
%%timeit
indexes, metrics = model.analogy(pos=['paris', 'germany'], neg=['france'], n=5000)
model.generate_response(indexes, metrics)
In [18]:
%%timeit
indexes, metrics = model.analogy(pos=['paris', 'germany'], neg=['france'], n=5000)
model.generate_response(indexes, metrics).tolist()
In [ ]: