code: def test_als_save_load():
      original = als.BiasedMF(5, iterations=5, method="lu")
      ratings = lktu.ml_test.ratings
      original.fit(ratings)
  
      assert original.bias.mean_ == approx(ratings.rating.mean())
  
      mod = pickle.dumps(original)
      _log.info("serialized to %d bytes", len(mod))
  
      algo = pickle.loads(mod)
      assert algo.bias.mean_ == original.bias.mean_
      assert np.all(
          algo.bias.user_offsets_ == original.bias.user_offsets_
      )
      assert np.all(
          algo.bias.item_offsets_ == original.bias.item_offsets_
      )
      assert np.all(algo.user_features_ == original.user_features_)
      assert np.all(algo.item_features_ == original.item_features_)
      assert np.all(algo.item_index_ == original.item_index_)
      assert np.all(algo.user_index_ == original.user_index_)
  
      # make sure it still works
      preds = algo.predict_for_user(10, np.arange(0, 50, dtype="i8"))
      assert len(preds) == 50
  
imports: import logging
  import pickle
  from pickletools import dis
  from lenskit.algorithms import als
  from lenskit import util
  import pandas
  import numpy
  from seedbank import numpy_rng
  from pytest import approx, mark
  from lenskit.util import Stopwatch
  import lenskit.util.test
label_desc: Use image node_id 11 for calling a global function with example usage: test_als_save_load() without return types