code: def test_precision_recall(data_implicit_factorization, k):
      (train, test, model) = data_implicit_factorization
  
      interactions = movielens.get_movielens_dataset("100K")
      train, test = random_train_test_split(
          interactions, random_state=RANDOM_STATE
      )
  
      precision, recall = precision_recall_score(
          model, test, train, k=k
      )
  
      assert precision.shape == recall.shape
  
      if not isinstance(k, list):
          assert len(precision.shape) == 1
      else:
          assert precision.shape[1] == len(k)
  
file_path: spotlight/tests/test_evaluation_metrics.py
imports: import os
  import numpy
  import pytest
  from spotlight.evaluation import precision_recall_score, sequence_precision_recall_score
  from spotlight.cross_validation import random_train_test_split, user_based_train_test_split
  from spotlight.datasets import movielens
  from spotlight.factorization.implicit import ImplicitFactorizationModel
  from spotlight.sequence.implicit import ImplicitSequenceModel
label_desc: Use image node_id 4 for calling a global function with example usage: test_precision_recall(data_implicit_factorization, k) without return types