a31eab99dfbc6dcb7fe2ef149c59a30910adbbbd,src/gensim/similarities/docsim.py,SparseMatrixSimilarity,getSimilarities,#SparseMatrixSimilarity#Any#,206
Before Change
// compute cosine similarity against every other document in the collection
allSims = self.corpus * vec.tocsc() // N x T * T x 1 = N x 1
allSims = list(allSims.toarray().flat) // convert to plain python list
assert len(allSims) == self.corpus.shape[0] // make sure no document got lost!
return allSims
//endclass SparseMatrixSimilarity
After Change
// compute cosine similarity against every other document in the collection
result = self.corpus * query.tocsc() // N x T * T x C = N x C
if result.shape[1] == 1:
// for queries of one document, return a 1d array
result = result.toarray().flatten()
else:
// otherwise, return a 2d matrix (//queries x //index)
result = result.toarray().T
return result
//endclass SparseMatrixSimilarity
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 5
Instances Project Name: RaRe-Technologies/gensim
Commit Name: a31eab99dfbc6dcb7fe2ef149c59a30910adbbbd
Time: 2011-05-15
Author: radimrehurek@seznam.cz
File Name: src/gensim/similarities/docsim.py
Class Name: SparseMatrixSimilarity
Method Name: getSimilarities
Project Name: theislab/scanpy
Commit Name: 14124ebc79621009018907a2f0564b52b557ba92
Time: 2018-12-09
Author: f.alex.wolf@gmx.de
File Name: scanpy/tools/score_genes.py
Class Name:
Method Name: score_genes
Project Name: markovmodel/PyEMMA
Commit Name: cf1e0faf5c3d04fd54bceeb7fa8c51dfd8120299
Time: 2017-05-26
Author: simols@hotmail.com
File Name: pyemma/msm/estimators/maximum_likelihood_msm.py
Class Name: AugmentedMarkovModel
Method Name: _estimate