code: def test_fallback_save_load(tmp_path):
      original = basic.Fallback(basic.Memorized(simple_df), Bias())
      original.fit(lktu.ml_test.ratings)
  
      fn = tmp_path / "fb.mod"
  
      binpickle.dump(original, fn)
  
      algo = binpickle.load(fn)
  
      bias = algo.algorithms[1]
      assert bias.mean_ == approx(lktu.ml_test.ratings.rating.mean())
  
      def exp_val(user, item):
          v = bias.mean_
          if user is not None:
              v += bias.user_offsets_.loc[user]
          if item is not None:
              v += bias.item_offsets_.loc[item]
          return v
  
      # first user + item
      preds = algo.predict_for_user(10, [1])
      assert preds.loc[1] == 4.0
      # second user + first item
      preds = algo.predict_for_user(15, [1])
      assert preds.loc[1] == approx(exp_val(15, 1))
  
      # second item + user item
      preds = algo.predict_for_user(12, [2])
      assert preds.loc[2] == approx(exp_val(12, 2))
  
      # blended
      preds = algo.predict_for_user(10, [1, 5])
      assert preds.loc[1] == 4.0
      assert preds.loc[5] == approx(exp_val(10, 5))
  
      # blended unknown
      preds = algo.predict_for_user(10, [5, 1, -23081])
      assert len(preds) == 3
      assert preds.loc[1] == 4.0
      assert preds.loc[5] == approx(exp_val(10, 5))
      assert preds.loc[-23081] == approx(exp_val(10, None))
  
file_path: lkpy/tests/test_fallback.py
imports: from lenskit.algorithms import basic
  from lenskit.algorithms.bias import Bias
  from lenskit import util
  import pandas
  import numpy
  import binpickle
  import lenskit.util.test
  from pytest import approx
label_desc: Use image node_id 7 for calling a global function with example usage: test_fallback_save_load(tmp_path) and returns: v