code: def test_uu_known_preds():
      from lenskit import batch
  
      algo = knn.UserUser(30, min_sim=1.0e-6)
      _log.info("training %s on ml data", algo)
      algo.fit(lktu.ml_test.ratings)
  
      dir = Path(__file__).parent
      pred_file = dir / "user-user-preds.csv"
      _log.info("reading known predictions from %s", pred_file)
      known_preds = pd.read_csv(str(pred_file))
      pairs = known_preds.loc[:, ["user", "item"]]
      _log.info("generating %d known predictions", len(pairs))
  
      preds = batch.predict(algo, pairs)
      merged = pd.merge(
          known_preds.rename(columns={"prediction": "expected"}), preds
      )
      assert len(merged) == len(preds)
      merged["error"] = merged.expected - merged.prediction
      try:
          assert not any(
              merged.prediction.isna() & merged.expected.notna()
          )
      except AssertionError as e:
          bad = merged[
              merged.prediction.isna() & merged.expected.notna()
          ]
          _log.error("%d missing predictions:\n%s", len(bad), bad)
          raise e
  
      err = merged.error
      err = err[err.notna()]
      try:
          assert all(err.abs() < 0.01)
      except AssertionError as e:
          bad = merged[
              merged.error.notna() & (merged.error.abs() >= 0.01)
          ]
          _log.error("%d erroneous predictions:\n%s", len(bad), bad)
          raise e
  
imports: from lenskit.algorithms import Recommender
  import lenskit.algorithms.user_knn
  from lenskit.util import clone
  from pathlib import Path
  import logging
  import pickle
  import pandas
  import numpy
  from scipy.sparse import linalg
  from pytest import approx, mark
  import lenskit.util.test
label_desc: Use image node_id 15 for calling a global function with example usage: test_uu_known_preds() without return types