code: def test_get_representations():
      model = LightFM(random_state=SEED)
      model.fit_partial(train, epochs=10)
  
      num_users, num_items = train.shape
  
      for item_features, user_features in (
          (None, None),
          (
              (
                  sp.identity(num_items)
                  + sp.random(num_items, num_items)
              ),
              (
                  sp.identity(num_users)
                  + sp.random(num_users, num_users)
              ),
          ),
      ):
          test_predictions = model.predict(
              test.row,
              test.col,
              user_features=user_features,
              item_features=item_features,
          )
  
          item_biases, item_latent = model.get_item_representations(
              item_features
          )
          user_biases, user_latent = model.get_user_representations(
              user_features
          )
  
          assert item_latent.dtype == np.float32
          assert user_latent.dtype == np.float32
  
          predictions = (
              (user_latent[test.row] * item_latent[test.col]).sum(
                  axis=1
              )
              + user_biases[test.row]
              + item_biases[test.col]
          )
  
          assert np.allclose(
              test_predictions, predictions, atol=0.000001
          )
  
imports: import pickle
  import numpy
  import scipy.sparse
  from scipy import stats
  from sklearn.metrics import roc_auc_score
  from sklearn.model_selection import KFold, RandomizedSearchCV
  from lightfm.lightfm import LightFM
  from lightfm.datasets import fetch_movielens
  from lightfm.evaluation import auc_score, precision_at_k
label_desc: Use image node_id 18 for calling a global function with example usage: test_get_representations() without return types