code: def test_sequence_precision_recall(data_implicit_sequence, k):
      (train, test, model) = data_implicit_sequence
  
      precision, recall = sequence_precision_recall_score(
          model, test, k
      )
      precision = precision.mean()
      recall = recall.mean()
  
      # with respect to the hyper-parameters specified in data_implicit_sequence
      expected_precision = 0.064
      expected_recall = 0.064
  
      # true_pos/(true_pos + false_pos) == true_pos/(true_pos + false_neg)
      # because num_predictions is set equal to num_targets in sequence_precision_recall_score
      assert precision == recall
      assert (
          expected_precision - EPSILON < precision
          and precision < expected_precision + EPSILON
      )
      assert (
          expected_recall - EPSILON < recall
          and recall < expected_recall + EPSILON
      )
  
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 3 for calling a global function with example usage: test_sequence_precision_recall(data_implicit_sequence, k) without return types