code: def test_sar_item_similarity(
      spark,
      threshold,
      similarity_type,
      file,
      demo_usage_data,
      sar_settings,
      header,
  ):
      model = SARPlus(
          spark,
          **header,
          timedecay_formula=False,
          time_decay_coefficient=30,
          time_now=None,
          threshold=threshold,
          similarity_type=similarity_type,
      )
  
      df = spark.createDataFrame(demo_usage_data)
      model.fit(df)
  
      # reference
      item_similarity_ref = pd.read_csv(
          sar_settings["FILE_DIR"]
          + "sim_"
          + file
          + str(threshold)
          + ".csv"
      )
  
      item_similarity_ref = pd.melt(
          item_similarity_ref,
          item_similarity_ref.columns[0],
          item_similarity_ref.columns[1:],
          "i2",
          "value",
      )
      item_similarity_ref.columns = ["i1", "i2", "value"]
  
      item_similarity_ref = (
          item_similarity_ref[item_similarity_ref.value > 0]
          .sort_values(["i1", "i2"])
          .reset_index(drop=True)
      )
      # actual
      item_similarity = (
          model.item_similarity.toPandas()
          .sort_values(["i1", "i2"])
          .reset_index(drop=True)
      )
  
      if similarity_type == "cooccurrence":
          assert (item_similarity_ref == item_similarity).all().all()
      else:
          assert (
              (
                  item_similarity.iloc[:, :1]
                  == item_similarity_ref.iloc[:, :1]
              )
              .all()
              .all()
          )
  
          assert np.allclose(
              item_similarity.value.values,
              item_similarity_ref.value.values,
              atol=sar_settings["ATOL"],
          )
  
imports: import math
  from pathlib import Path
  import numpy
  import pandas
  from pyspark.sql import SparkSession
  import pytest
  from pandas.testing import assert_frame_equal
  from pysarplus import SARPlus, SARModel
label_desc: Use image node_id 12 for calling a global function with example usage: test_sar_item_similarity(spark, threshold, similarity_type, file, demo_usage_data, sar_settings, header) without return types