code: def do_prepare(opts):
      name = opts["-d"]
      ml = MovieLens(f"data/{name}")
  
      train, test = next(sample_users(ml.ratings, 1, 10000, SampleN(5)))
  
      test.to_parquet(f"data/{name}-test.parquet", index=False)
  
      _log.info("getting popular recs")
      pop = Popular()
      pop.fit(train)
      pop_recs = recommend(pop, test["user"].unique(), 100)
  
      _log.info("getting ALS recs")
      als = ImplicitMF(20, iterations=10)
      als = Recommender.adapt(als)
      als.fit(train.drop(columns=["rating"]))
      als_recs = recommend(als, test["user"].unique(), 100)
  
      _log.info("merging recs")
      recs = pd.concat(
          {"Popular": pop_recs, "ALS": als_recs}, names=["Algorithm"]
      )
      recs.reset_index("Algorithm", inplace=True)
      recs.to_parquet(f"data/{name}-recs.parquet", index=False)
  
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 1 for calling a global function with example usage: do_prepare(opts) without return types