code: def test_als_train_large():
      algo = als.BiasedMF(20, iterations=10)
      ratings = lktu.ml_test.ratings
      algo.fit(ratings)
  
      assert algo.bias.mean_ == approx(ratings.rating.mean())
      assert algo.n_features == 20
      assert algo.n_items == ratings.item.nunique()
      assert algo.n_users == ratings.user.nunique()
  
      icounts = ratings.groupby("item").rating.count()
      isums = ratings.groupby("item").rating.sum()
      is2 = isums - icounts * ratings.rating.mean()
      imeans = is2 / (icounts + 5)
      ibias = pd.Series(algo.bias.item_offsets_, index=algo.item_index_)
      imeans, ibias = imeans.align(ibias)
      assert ibias.values == approx(imeans.values)
  
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 10 for calling a global function with example usage: test_als_train_large() without return types