code: def do_measure(opts):
      name = opts["-d"]
  
      _log.info("reading data %s", name)
      test = pd.read_parquet(f"data/{name}-test.parquet")
      recs = pd.read_parquet(f"data/{name}-recs.parquet")
  
      _log.info("setting up analysis")
      rla = RecListAnalysis()
      rla.add_metric(ndcg)
      rla.add_metric(recip_rank)
  
      timer = Stopwatch()
      results = rla.compute(recs, test, include_missing=True)
      _log.info("analyzed in %s", timer)
  
      results = results.fillna(0)
      a_res = results.groupby("Algorithm").mean()
      a_res["count"] = results.groupby("Algorithm")["nrecs"].count()
      _log.info("finished")
      print(a_res)
      print(results.groupby("Algorithm")["recip_rank"].describe())
  
file_path: lkpy/utils/rla-perf.py
imports: import sys
  import logging
  import tqdm
  from docopt import docopt
  import pandas
  from lenskit.datasets import MovieLens
  from lenskit.util import Stopwatch
  from lenskit.batch import recommend
  from lenskit.crossfold import sample_users, SampleN
  from lenskit.algorithms.basic import Popular
  from lenskit.algorithms import Recommender
  from lenskit.algorithms.als import ImplicitMF
  from lenskit.topn import RecListAnalysis, ndcg, recip_rank
label_desc: Use image node_id 2 for calling a global function with example usage: do_measure(opts) without return types