code: def test_predict_single(mlb):
      tf = pd.DataFrame({"user": [1], "item": [31]})
      res = lkb.predict(mlb.algo, tf)
  
      assert len(res) == 1
      assert all(res.user == 1)
      assert set(res.columns) == set(["user", "item", "prediction"])
      assert all(res.item == 31)
  
      expected = (
          mlb.algo.mean_
          + mlb.algo.item_offsets_.loc[31]
          + mlb.algo.user_offsets_.loc[1]
      )
      assert res.prediction.iloc[0] == pytest.approx(expected)
  
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 2 for calling a global function with example usage: test_predict_single(mlb) without return types