code: def test_incremental_retrain(use_gpu):
      likes = get_checker_board(50)
  
      model = AlternatingLeastSquares(
          factors=2, regularization=0, use_gpu=use_gpu, random_state=23
      )
      model.fit(likes, show_progress=False)
  
      ids, _ = model.recommend(0, likes[0])
      assert ids[0] == 0
  
      # refit the model for user 0, make them like the same thing as user 1
      model.partial_fit_users([0], likes[1])
      ids, _ = model.recommend(0, likes[1])
      assert ids[0] == 1
  
      # add a new user at position 100, make sure we can also use that for recommendations
      model.partial_fit_users([100], likes[1])
      ids, _ = model.recommend(100, likes[1])
      assert ids[0] == 1
  
      # add a new item at position 100, make sure it gets recommended for user right away
      model.partial_fit_items([100], likes[1])
      ids, _ = model.recommend(1, likes[1], N=2)
      assert set(ids) == {1, 100}
  
      # check to make sure we can index only a single extra item/user
      model.partial_fit_users([101], likes[1])
      model.partial_fit_items([101], likes[1])
      ids, _ = model.recommend(101, likes[1], N=3)
      assert set(ids) == {1, 100, 101}
  
imports: import pickle
  import unittest
  import numpy
  import pytest
  from numpy.testing import assert_array_equal
  from recommender_base_test import RecommenderBaseTestMixin, get_checker_board
  from scipy.sparse import coo_matrix, csr_matrix, random
  import implicit
  from implicit.als import AlternatingLeastSquares
  from implicit.gpu import HAS_CUDA
label_desc: Use image node_id 9 for calling a global function with example usage: test_incremental_retrain(use_gpu) without return types