class_docstr: Holds necessary (minimal) information needed for inference
class_docstr_tok: ["Holds","necessary","(","minimal",")","information","needed","for","inference"]
docstr: Main inference method
  
  Args:
      dataPtr (DataPtr): An object containing the X, Z features needed for inference
      W (iterable): An iterable containing the U, B, V parametrized matrices.
docstr_tok: ["Main","inference","method","Args",":","dataPtr","(","DataPtr",")",":","An","object","containing","the","X",",","Z","features","needed","for","inference","W","(","iterable",")",":","An","iterable","containing","the","U",",","B",",","V","parametrized","matrices","."]
code: def infer(self, dataPtr, W, **kwargs):
      """Main inference method
  
      Args:
          dataPtr (DataPtr): An object containing the X, Z features needed for inference
          W (iterable): An iterable containing the U, B, V parametrized matrices.
      """
  
      if isinstance(dataPtr, list):
          a = dataPtr[0]
          b = dataPtr[1]
      else:
          a = dataPtr.get_entity("row").dot(W[0]).dot(sqrtm(W[1]))
          b = dataPtr.get_entity("col").dot(W[2]).dot(sqrtm(W[1]))
  
      sim_score = self.method(a, b).sim(**kwargs)
  
      if self.transformation == "mean":
          prediction = conv_binary(sim_score, sim_score.mean())
      elif self.transformation == "topk":
          masked_sim_score = sim_score.copy()
  
          for i in range(sim_score.shape[0]):
              topKidx = np.argpartition(masked_sim_score[i], -self.k)[
                  -self.k :
              ]
              mask = np.ones(sim_score[i].size, dtype=bool)
              mask[topKidx] = False
  
              masked_sim_score[i][topKidx] = 1
              masked_sim_score[i][mask] = 0
          prediction = masked_sim_score
      else:
          prediction = sim_score
  
      return prediction
  
file_path: recommenders/recommenders/models/geoimc/geoimc_predict.py
imports: import numpy
  from scipy.linalg import sqrtm
  from recommenders.utils.python_utils import binarize
label_desc: Use image node_id 3 for calling the Inferer obj's underlying member method code with example usage: obj.infer(dataPtr, W) and returns: prediction