code: def test_fsvd_batch_accuracy():
      from lenskit.algorithms import basic
      from lenskit.algorithms import bias
      import lenskit.crossfold as xf
      from lenskit import batch
      import lenskit.metrics.predict as pm
  
      ratings = lktu.ml100k.ratings
  
      svd_algo = svd.FunkSVD(25, 125, damping=10)
      algo = basic.Fallback(svd_algo, bias.Bias(damping=10))
  
      def eval(train, test):
          _log.info("running training")
          algo.fit(train)
          _log.info("testing %d users", test.user.nunique())
          return batch.predict(algo, test)
  
      folds = xf.partition_users(ratings, 5, xf.SampleFrac(0.2))
      preds = pd.concat(eval(train, test) for (train, test) in folds)
      mae = pm.mae(preds.prediction, preds.rating)
      assert mae == approx(0.74, abs=0.025)
  
      user_rmse = preds.groupby("user").apply(
          lambda df: pm.rmse(df.prediction, df.rating)
      )
      assert user_rmse.mean() == approx(0.92, abs=0.05)
  
file_path: lkpy/tests/test_funksvd.py
imports: import logging
  import pickle
  from pathlib import Path
  import lenskit.algorithms.funksvd
  import pandas
  import numpy
  from pytest import approx, mark
  import lenskit.util.test
label_desc: Use image node_id 12 for calling a global function with example usage: test_fsvd_batch_accuracy() and returns: batch