Gw mau tau True dari NumPy

Pencarian Nearest Neighbour - Algoritma Python Iteratif dan versi vektorisasi NumPy yang sepadan

>>> # # # Pure iterative Python # # #

>>> for idx, point in enumerate(points):  # iterate over all points

...     dist = sum([(dp-dq)**2 for dp,dq in zip(point,qPoint)])**0.5  # compute the euclidean distance for each point to q

...     if dist < minDist or minDist < 0:  # if necessary, update minimum distance and index of the corresponding point