def correlationTop(target, bucket): best = -1 bestKey = "" count = 0 for k, v in s3.getImgs(bucket).items(): thisCorrelation = oneDPearsonHelp(target, centerCut(v)) if thisCorrelation > best: best = thisCorrelation bestKey = k count += 1 return (bestKey, best, count)
def distanceTop(target, bucket): best = sys.maxint bestKey = "" count = 0 for k, v in s3.getImgs(bucket).items(): thisDist = rawDistanceHelp(target, centerCut(v)) if thisDist < best: best = thisDist bestKey = k count += 1 return (bestKey, best, count)