code: def test_als_predict_for_new_users_with_new_ratings():
      """
      Test if ImplicitMF predictions using the same ratings for a new user
      is the same as a user in ml-latest-small dataset.
      The test is run for more than one user.
      """
      n_users = 3
      n_items = 2
      new_u_id = -1
      ratings = lktu.ml_test.ratings
  
      np.random.seed(45)
      users = np.random.choice(ratings.user.unique(), n_users)
      items = np.random.choice(ratings.item.unique(), n_items)
  
      algo = als.ImplicitMF(
          20, iterations=10, method="lu", use_ratings=False
      )
      algo.fit(ratings)
      _log.debug("Items: " + str(items))
  
      for u in users:
          _log.debug(f"user: {u}")
          preds = algo.predict_for_user(u, items)
          upos = algo.user_index_.get_loc(u)
  
          user_data = ratings[ratings.user == u]
  
          _log.debug(
              "user_features from fit: "
              + str(algo.user_features_[upos, :])
          )
  
          # get the user's rating series
          new_ratings = user_data.set_index("item")["rating"].copy()
          new_preds = algo.predict_for_user(
              new_u_id, items, new_ratings
          )
  
          _log.debug("preds: " + str(preds.values))
          _log.debug("new_preds: " + str(new_preds.values))
          _log.debug("------------")
  
          diffs = np.abs(preds.values - new_preds.values)
          assert all(diffs <= 0.1)
  
imports: import logging
  from lenskit import util
  from lenskit.algorithms import als
  import pandas
  import numpy
  from scipy import stats
  import binpickle
  from seedbank import numpy_rng
  from pytest import mark, approx
  import lenskit.util.test
  from lenskit.algorithms import Recommender
  from lenskit.util import Stopwatch
label_desc: Use image node_id 5 for calling a global function with example usage: test_als_predict_for_new_users_with_new_ratings() without return types