a31eab99dfbc6dcb7fe2ef149c59a30910adbbbd,src/gensim/similarities/docsim.py,SparseMatrixSimilarity,getSimilarities,#SparseMatrixSimilarity#Any#,206

Before Change


                vec[fieldId, 0] = fieldValue
        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.tocsc() // N x T * T x 1 = N x 1

After Change


                query = scipy.sparse.csc_matrix(query)
            else:
                // default case: query is a single vector, in sparse gensim format
                query = matutils.corpus2csc([query], self.corpus.shape[1])

        // 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

Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 7

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: ca78010feee2c809ac08efbf0417a057206deb18
Time: 2019-06-26
Author: ivirshup@gmail.com
File Name: scanpy/get.py
Class Name:
Method Name: obs_df


Project Name: theislab/scanpy
Commit Name: ca78010feee2c809ac08efbf0417a057206deb18
Time: 2019-06-26
Author: ivirshup@gmail.com
File Name: scanpy/get.py
Class Name:
Method Name: var_df