code: def _score(items, results, iur, sims, nnbrs, min_sim, min_nbrs, agg):
      h_ks = np.empty(nnbrs, dtype=np.int32)
      h_vs = np.empty(nnbrs)
      used = np.zeros(len(results), dtype=np.int32)
  
      for i in range(len(results)):
          item = items[i]
          if item < 0:
              continue
  
          h_ep = 0
  
          # who has rated this item?
          i_users = iur.row_cs(item)
  
          # what are their similarities to our target user?
          i_sims = sims[i_users]
  
          # which of these neighbors do we really want to use?
          for j, s in enumerate(i_sims):
              if np.abs(s) < 1.0e-10:
                  continue
              if min_sim is not None and s < min_sim:
                  continue
              h_ep = kvp_minheap_insert(
                  0, h_ep, nnbrs, j, s, h_ks, h_vs
              )
  
          if h_ep < min_nbrs:
              continue
  
          results[i] = agg(iur, item, i_sims, h_ks[:h_ep])
          used[i] = h_ep
  
      return used
  
imports: from sys import intern
  import logging
  import pandas
  import numpy
  from numba import njit
  from ..None import util
  from ..data import sparse_ratings
  from .None import Predictor
  from ..util.accum import kvp_minheap_insert
label_desc: Use image node_id 3 for calling a global function with example usage: _score(items, results, iur, sims, nnbrs, min_sim, min_nbrs, agg) and returns: used