code: def test_bias_batch_predict(ncpus):
      from lenskit.algorithms import bias
      import lenskit.crossfold as xf
      from lenskit import batch
      import lenskit.metrics.predict as pm
  
      ratings = lktu.ml100k.ratings
  
      algo = bias.Bias(damping=5)
  
      def eval(train, test):
          _log.info("running training")
          algo.fit(train)
          _log.info("testing %d users", test.user.nunique())
          recs = batch.predict(algo, test, n_jobs=ncpus)
          return recs
  
      preds = pd.concat(
          (
              eval(train, test)
              for (train, test) in xf.partition_users(
                  ratings, 5, xf.SampleFrac(0.2)
              )
          )
      )
  
      _log.info("analyzing predictions")
      rmse = pm.rmse(preds.prediction, preds.rating)
      _log.info("RMSE is %f", rmse)
      assert rmse == pytest.approx(0.95, abs=0.1)
  
file_path: lkpy/tests/test_batch_predict.py
imports: import pytest
  import logging
  from collections import namedtuple
  import pandas
  import numpy
  import lenskit.util.test
  from lenskit.algorithms.bias import Bias
  import lenskit.batch
label_desc: Use image node_id 6 for calling a global function with example usage: test_bias_batch_predict(ncpus) and returns: recs