code: def test_adv_fill_users():
      rla = topn.RecListAnalysis()
      rla.add_metric(topn.precision)
      rla.add_metric(topn.recall)
  
      a_uu = UserUser(30, min_nbrs=10)
      a_uu = Recommender.adapt(a_uu)
      a_ii = ItemItem(20, min_nbrs=4)
      a_ii = Recommender.adapt(a_ii)
  
      splits = xf.sample_users(ml_test.ratings, 2, 50, xf.SampleN(5))
      all_recs = {}
      all_test = {}
      for i, (train, test) in enumerate(splits):
          a_uu.fit(train)
          rec_users = test["user"].sample(50).unique()
          all_recs[(i + 1, "UU")] = batch.recommend(a_uu, rec_users, 25)
  
          a_ii.fit(train)
          rec_users = test["user"].sample(50).unique()
          all_recs[(i + 1, "II")] = batch.recommend(a_ii, rec_users, 25)
          all_test[i + 1] = test
  
      recs = pd.concat(all_recs, names=["part", "algo"])
      recs.reset_index(["part", "algo"], inplace=True)
      recs.reset_index(drop=True, inplace=True)
  
      test = pd.concat(all_test, names=["part"])
      test.reset_index(["part"], inplace=True)
      test.reset_index(drop=True, inplace=True)
  
      scores = rla.compute(recs, test, include_missing=True)
      inames = scores.index.names
      scores.sort_index(inplace=True)
      assert len(scores) == 50 * 4
      assert all(scores["ntruth"] == 5)
      assert scores["recall"].isna().sum() > 0
      _log.info("scores:\n%s", scores)
  
      ucounts = (
          scores.reset_index()
          .groupby("algo")["user"]
          .agg(["count", "nunique"])
      )
      assert all(ucounts["count"] == 100)
      assert all(ucounts["nunique"] == 100)
  
      mscores = rla.compute(recs, test)
      mscores = mscores.reset_index().set_index(inames)
      mscores.sort_index(inplace=True)
      assert len(mscores) < len(scores)
      _log.info("mscores:\n%s", mscores)
  
      recall = scores.loc[scores["recall"].notna(), "recall"].copy()
      recall, mrecall = recall.align(mscores["recall"])
      assert all(recall == mrecall)
  
imports: from pathlib import Path
  import logging
  import numpy
  import pandas
  from pytest import approx, mark
  from lenskit.algorithms.user_knn import UserUser
  from lenskit.algorithms.item_knn import ItemItem
  from lenskit.algorithms.basic import PopScore
  from lenskit.algorithms.ranking import PlackettLuce
  from lenskit.algorithms import Recommender
  from lenskit.util.test import ml_test, demo_recs
  from lenskit.metrics.topn import _dcg, precision, recall
  from lenskit import topn, batch, crossfold
label_desc: Use image node_id 9 for calling a global function with example usage: test_adv_fill_users() without return types