4220efc634021812eba44cdd97e914ec026b0e7a,dvalib/retriever.py,BaseRetriever,nearest,#BaseRetriever#Any#Any#,33

Before Change


    def nearest(self, vector=None, n=12):
        temp = []
        dist = []
        for k in xrange(self.index.shape[0]):
            temp.append(self.index[k])
            if (k+1) % 50000 == 0:
                temp = np.transpose(np.dstack(temp)[0])
                dist.append(spatial.distance.cdist(vector,temp))
                temp = []
        if temp:
            temp = np.transpose(np.dstack(temp)[0])
            dist.append(spatial.distance.cdist(vector,temp))
        results = []

After Change


    def nearest(self, vector=None, n=12):
        dist = None
        results = []
        if self.index is not None:
            // logging.info("{} and {}".format(vector.shape,self.index.shape))
            dist = spatial.distance.cdist(vector,self.index)
        if dist is not None:
            ranked = np.squeeze(dist.argsort())
            for i, k in enumerate(ranked[:n]):
                temp = {"rank":i+1,"algo":self.name,"dist":float(dist[0,k])}
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 3

Instances


Project Name: AKSHAYUBHAT/DeepVideoAnalytics
Commit Name: 4220efc634021812eba44cdd97e914ec026b0e7a
Time: 2017-08-26
Author: akshayubhat@gmail.com
File Name: dvalib/retriever.py
Class Name: BaseRetriever
Method Name: nearest


Project Name: chainer/chainercv
Commit Name: 92e4f9fc21754db063e055f7873b5452e0f2fa51
Time: 2017-04-26
Author: yuyuniitani@gmail.com
File Name: chainercv/evaluations/eval_detection.py
Class Name:
Method Name: eval_detection


Project Name: keras-team/keras
Commit Name: d5455154f2a9f055e601e14dd5e8e3fea2ac4721
Time: 2015-08-17
Author: francois.chollet@gmail.com
File Name: examples/addition_rnn.py
Class Name:
Method Name:


Project Name: aleju/imgaug
Commit Name: bc87005e5dce729044e1a10286f9124d652e34d6
Time: 2019-08-25
Author: kontakt@ajung.name
File Name: imgaug/augmentables/kps.py
Class Name: Keypoint
Method Name: generate_similar_points_manhattan