class_docstr: Common predictor for matrix factorization.
  
  Attributes:
      user_index_(pandas.Index): Users in the model (length=:math:`m`).
      item_index_(pandas.Index): Items in the model (length=:math:`n`).
      user_features_(numpy.ndarray): The :math:`m \times k` user-feature matrix.
      item_features_(numpy.ndarray): The :math:`n \times k` item-feature matrix.
class_docstr_tok: ["Common","predictor","for","matrix","factorization",".","Attributes",":","user_index_","(","pandas.Index",")",":","Users","in","the","model","(","length=",":","math",":","`","m","`",")",".","item_index_","(","pandas.Index",")",":","Items","in","the","model","(","length=",":","math",":","`","n","`",")",".","user_features_","(","numpy.ndarray",")",":","The",":","math",":","`","m","\\times","k","`","user-feature","matrix",".","item_features_","(","numpy.ndarray",")",":","The",":","math",":","`","n","\\times","k","`","item-feature","matrix","."]
code: def score_by_ids(self, user, items, u_features=None):
      if u_features is None:
          uidx = self.lookup_user(user)
          if uidx < 0:
              _logger.debug("user %s not in model", user)
              return pd.Series(np.nan, index=items)
      else:
          uidx = None
  
      # get item index & limit to valid ones
      items = np.array(items)
      iidx = self.lookup_items(items)
      good = iidx >= 0
      good_items = items[good]
      good_iidx = iidx[good]
  
      # multiply
      _logger.debug(
          "scoring %d items for user %s", len(good_items), user
      )
      rv = self.score(uidx, good_iidx, u_features)
  
      res = pd.Series(rv, index=good_items)
      res = res.reindex(items)
      return res
  
file_path: lkpy/lenskit/algorithms/mf_common.py
imports: import logging
  import numpy
  import pandas
  from .None import Predictor
label_desc: Use image node_id 7 for calling the MFPredictor obj's underlying member method code with example usage: obj.score_by_ids(user, items, u_features) and returns: res, pd