20f388cfe01635a2073723c5c4ffd6dd7a87fbb2,tensorflow_hub/tools/module_search/utils.py,,knn_errorrate_loo,#,140

Before Change


  cnt = 0
  for i in range(np.shape(d)[0]):
    cnt_i = 0
    for j in range(k):
      if y[i] != y[indices[i, j]]:
        cnt_i += 1
    if cnt_i >= k / 2.0:
      cnt += 1

  return float(cnt) / np.shape(d)[0]

After Change


  for i in range(np.shape(d)[0]):

    // Get max vote
    labels = y[indices[i, :k]]
    keys, counts = np.unique(labels, return_counts=True)
    maxkey = keys[np.argmax(counts)]
    if y[i] != maxkey:
      cnt += 1
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: tensorflow/hub
Commit Name: 20f388cfe01635a2073723c5c4ffd6dd7a87fbb2
Time: 2019-11-15
Author: cedric.renggli@gmail.com
File Name: tensorflow_hub/tools/module_search/utils.py
Class Name:
Method Name: knn_errorrate_loo


Project Name: tensorflow/hub
Commit Name: 20f388cfe01635a2073723c5c4ffd6dd7a87fbb2
Time: 2019-11-15
Author: cedric.renggli@gmail.com
File Name: tensorflow_hub/tools/module_search/utils.py
Class Name:
Method Name: knn_errorrate


Project Name: suavecode/SUAVE
Commit Name: e73418dbc43053ccb522e94e9846de1c88667b73
Time: 2017-04-01
Author: ebotero@stanford.edu
File Name: trunk/SUAVE/Components/Energy/Networks/Propulsor_Surrogate.py
Class Name: Propulsor_Surrogate
Method Name: build_surrogate