e20d7b28bb811000edd0790fb72df9e68875a063,src/gensim/similarities/docsim.py,MatrixSimilarity,getSimilarities,#MatrixSimilarity#Any#,121
Before Change
vec = matutils.sparse2full(doc, self.numFeatures)
vec.shape = (vec.size, 1)
if vec.shape != (self.corpus.shape[1], 1):
raise ValueError("vector shape mismatch; expected %s, got %s" %
((self.corpus.shape[1], 1,), vec.shape))
// compute cosine similarity against every other document in the collection
allSims = self.corpus * vec // N x T * T x 1 = N x 1
allSims = list(allSims.flat) // convert to plain python list
assert len(allSims) == self.corpus.shape[0] // make sure no document got lost!
return allSims
After Change
vec = doc
else:
vec = matutils.sparse2full(doc, self.numFeatures)
vec = numpy.asfortranarray(vec, order = "F", dtype = self.corpus.dtype).reshape(self.numFeatures, 1)
// compute cosine similarity against every other document in the collection
gemv, = scipy.linalg.get_blas_funcs(("gemv",), (self.u,))
allSims = gemv(self.corpus, vec) // N x T * T x 1 = N x 1
In pattern: SUPERPATTERN
Frequency: 4
Non-data size: 10
Instances
Project Name: RaRe-Technologies/gensim
Commit Name: e20d7b28bb811000edd0790fb72df9e68875a063
Time: 2010-07-31
Author: piskvorky@92d0401f-a546-4972-9173-107b360ed7e5
File Name: src/gensim/similarities/docsim.py
Class Name: MatrixSimilarity
Method Name: getSimilarities
Project Name: RaRe-Technologies/gensim
Commit Name: af3357375250903ecb380051915e15ba721c42f4
Time: 2010-07-31
Author: radimrehurek@seznam.cz
File Name: src/gensim/similarities/docsim.py
Class Name: MatrixSimilarity
Method Name: getSimilarities
Project Name: tensorflow/transform
Commit Name: 93c5a8952f5a350c78243bc1ffa47b07f5f93721
Time: 2017-11-22
Author: tf-transform-dev@google.com
File Name: tensorflow_transform/coders/example_proto_coder.py
Class Name: _FixedLenFeatureHandler
Method Name: __init__
Project Name: tensorflow/transform
Commit Name: 51a0c5fbe8e236cdb7e58afce66d7639d8fe9a45
Time: 2017-10-20
Author: tf-transform-dev@google.com
File Name: tensorflow_transform/coders/example_proto_coder.py
Class Name: _FixedLenFeatureHandler
Method Name: __init__