code: def test_auc_score():
      no_users, no_items = (10, 100)
  
      train, test = _generate_data(no_users, no_items)
  
      model = LightFM(loss="bpr")
      model.fit_partial(train)
  
      auc = evaluation.auc_score(model, test, num_threads=2)
      expected_auc = np.array(_auc(model, test))
  
      assert auc.shape == expected_auc.shape
      assert np.abs(auc.mean() - expected_auc.mean()) < 0.01
      assert len(auc) == (test.getnnz(axis=1) > 0).sum()
      assert (
          len(evaluation.auc_score(model, train, preserve_rows=True))
          == test.shape[0]
      )
  
      # With omitting train interactions
      auc = evaluation.auc_score(
          model, test, train_interactions=train, num_threads=2
      )
      expected_auc = np.array(_auc(model, test, train))
      assert np.abs(auc.mean() - expected_auc.mean()) < 0.01
  
file_path: lightfm/tests/test_evaluation.py
imports: import numpy
  import pytest
  import scipy.sparse
  from sklearn.metrics import roc_auc_score
  from lightfm.lightfm import LightFM
  from lightfm import evaluation
label_desc: Use image node_id 8 for calling a global function with example usage: test_auc_score() without return types