code: def test_sar_item_similarity(
      threshold,
      similarity_type,
      file,
      demo_usage_data,
      sar_settings,
      header,
  ):
      model = SAR(
          similarity_type=similarity_type,
          timedecay_formula=False,
          time_decay_coefficient=30,
          threshold=threshold,
          **header,
      )
  
      # Remove duplicates
      demo_usage_data = demo_usage_data.sort_values(
          header["col_timestamp"], ascending=False
      )
      demo_usage_data = demo_usage_data.drop_duplicates(
          [header["col_user"], header["col_item"]], keep="first"
      )
  
      model.fit(demo_usage_data)
  
      true_item_similarity = pd.read_csv(
          sar_settings["FILE_DIR"]
          + "sim_"
          + file
          + str(threshold)
          + ".csv",
          index_col=0,
      )
      item2index = pd.Series(model.item2index)
      index = item2index[true_item_similarity.index]
      columns = item2index[true_item_similarity.columns]
  
      if similarity_type == "cooccurrence":
          test_item_similarity = pd.DataFrame(
              model.item_similarity.todense()
          )
          test_item_similarity = test_item_similarity.reindex(
              index=index, columns=columns
          )
          assert np.array_equal(
              true_item_similarity.astype("float64"),
              test_item_similarity.astype("float64"),
          )
      else:
          test_item_similarity = pd.DataFrame(model.item_similarity)
          test_item_similarity = test_item_similarity.reindex(
              index=index, columns=columns
          )
          assert np.allclose(
              true_item_similarity.astype("float64"),
              test_item_similarity.astype("float64"),
              atol=sar_settings["ATOL"],
          )
  
imports: import json
  import pytest
  import itertools
  import numpy
  import pandas
  from pandas.testing import assert_frame_equal
  from recommenders.utils.constants import DEFAULT_PREDICTION_COL
  from recommenders.models.sar import SAR
label_desc: Use image node_id 5 for calling a global function with example usage: test_sar_item_similarity(threshold, similarity_type, file, demo_usage_data, sar_settings, header) without return types