4595a8b03d2735f78575a5206717fe1b92ec5d2a,src/gensim/matutils.py,,unitVec,#Any#,47

Before Change


    
    If the input is sparse (list of 2-tuples), output will also be sparse.
    
    if len(vec) == 0:
        return vec
    first = iter(vec).next()
    if isinstance(first, tuple):
        vecLen = 1.0 * math.sqrt(sum(val * val for _, val in vec))
        assert vecLen > 0.0, "sparse documents must not contain any explicit zero entries"

After Change


    If the input is sparse (list of 2-tuples), output will also be sparse. Otherwise,
    output will be a numpy array.
    
    if scipy.sparse.issparse(vec):
        vec = vec.toarray().flatten()
    try:
        first = iter(vec).next()
    except:
        return vec
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: RaRe-Technologies/gensim
Commit Name: 4595a8b03d2735f78575a5206717fe1b92ec5d2a
Time: 2010-04-11
Author: radimrehurek@seznam.cz
File Name: src/gensim/matutils.py
Class Name:
Method Name: unitVec


Project Name: ClimbsRocks/auto_ml
Commit Name: 3f74cd386abdc18a4b0b48160686f9654fb22bc1
Time: 2016-12-01
Author: ClimbsBytes@gmail.com
File Name: auto_ml/utils_model_training.py
Class Name: FinalModelATC
Method Name: predict_proba


Project Name: RaRe-Technologies/gensim
Commit Name: 1524323f6cf1de9ce95c029cbdf264ac516b21d8
Time: 2010-04-11
Author: piskvorky@92d0401f-a546-4972-9173-107b360ed7e5
File Name: src/gensim/matutils.py
Class Name:
Method Name: unitVec