64710c051f26a2778c03fc15ef29c4bcae01df32,official/recommendation/ncf_main.py,,evaluate_model,#Any#Any#Any#,57

Before Change



  // NumPy has an np.argparition() method, however log(1000) is so small that
  // sorting the whole array is simpler and fast enough.
  top_indicies = np.argsort(predicted_scores_by_user, axis=1)[:, -_TOP_K:]
  top_indicies = np.flip(top_indicies, axis=1)

  // Both HR and NDCG vectorized computation takes advantage of the fact that if
  // the positive example for a user is not in the top k, that index does not
  // appear. That is to say:   hit_ind.shape[0] <= num_users
  hit_ind = np.argwhere(np.equal(top_indicies, 0))
  hr = hit_ind.shape[0] / ncf_dataset.num_users
  ndcg = np.sum(np.log(2) / np.log(hit_ind[:, 1] + 2)) / ncf_dataset.num_users

  global_step = estimator.get_variable_value(tf.GraphKeys.GLOBAL_STEP)
  eval_results = {
      _HR_KEY: hr,

After Change



  tf.logging.info("Computing metrics...")

  hr, ndcg = get_hit_rate_and_ndcg(predicted_scores_by_user, items_by_user,
                                   match_mlperf=FLAGS.ml_perf)

  global_step = estimator.get_variable_value(tf.GraphKeys.GLOBAL_STEP)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 5

Non-data size: 5

Instances


Project Name: tensorflow/models
Commit Name: 64710c051f26a2778c03fc15ef29c4bcae01df32
Time: 2018-08-22
Author: reedwm@google.com
File Name: official/recommendation/ncf_main.py
Class Name:
Method Name: evaluate_model


Project Name: LCAV/pyroomacoustics
Commit Name: 41efa2d36c4fab58b4e6ebb030bddabb9042d9e0
Time: 2020-07-28
Author: fakufaku@gmail.com
File Name: pyroomacoustics/doa/music.py
Class Name: MUSIC
Method Name: _subspace_decomposition


Project Name: lmcinnes/umap
Commit Name: c89dd09ac9b3dea95ed9754e22db56ec3824cb8a
Time: 2018-06-05
Author: leland.mcinnes@gmail.com
File Name: umap/tests/test_umap.py
Class Name:
Method Name: test_nn_descent_neighbor_accuracy


Project Name: biotite-dev/biotite
Commit Name: 495ec225e30ce898ad5801748346a65aabe4eb83
Time: 2018-07-09
Author: patrick.kunzm@gmail.com
File Name: doc/examples/scripts/structure/ramachandran.py
Class Name:
Method Name:


Project Name: astroML/astroML
Commit Name: b1402d88a210ddb402bee4189edd5bdb2ada8403
Time: 2019-01-02
Author: bsipocz@gmail.com
File Name: astroML/density_estimation/tests/test_hist_binwidth.py
Class Name:
Method Name: test_freedman_bin_width