class_docstr: Simple Algorithm for Recommendations (SAR) implementation
  
  SAR is a fast scalable adaptive algorithm for personalized recommendations based on user transaction history
  and items description. The core idea behind SAR is to recommend items like those that a user already has
  demonstrated an affinity to. It does this by 1) estimating the affinity of users for items, 2) estimating
  similarity across items, and then 3) combining the estimates to generate a set of recommendations for a given user.
class_docstr_tok: ["Simple","Algorithm","for","Recommendations","(","SAR",")","implementation","SAR","is","a","fast","scalable","adaptive","algorithm","for","personalized","recommendations","based","on","user","transaction","history","and","items","description",".","The","core","idea","behind","SAR","is","to","recommend","items","like","those","that","a","user","already","has","demonstrated","an","affinity","to",".","It","does","this","by","1",")","estimating","the","affinity","of","users","for","items",",","2",")","estimating","similarity","across","items",",","and","then","3",")","combining","the","estimates","to","generate","a","set","of","recommendations","for","a","given","user","."]
docstr: Compute time decay on provided column.
  
  Args:
      df (pandas.DataFrame): DataFrame of users and items
      decay_column (str): column to decay
  
  Returns:
      pandas.DataFrame: with column decayed
docstr_tok: ["Compute","time","decay","on","provided","column",".","Args",":","df","(","pandas.DataFrame",")",":","DataFrame","of","users","and","items","decay_column","(","str",")",":","column","to","decay","Returns",":","pandas.DataFrame",":","with","column","decayed"]
code: def compute_time_decay(self, df, decay_column):
      """Compute time decay on provided column.
  
      Args:
          df (pandas.DataFrame): DataFrame of users and items
          decay_column (str): column to decay
  
      Returns:
          pandas.DataFrame: with column decayed
      """
  
      # if time_now is None use the latest time
      if self.time_now is None:
          self.time_now = df[self.col_timestamp].max()
  
      # apply time decay to each rating
      df[decay_column] *= exponential_decay(
          value=df[self.col_timestamp],
          max_val=self.time_now,
          half_life=self.time_decay_half_life,
      )
  
      # group time decayed ratings by user-item and take the sum as the user-item affinity
      return (
          df.groupby([self.col_user, self.col_item]).sum().reset_index()
      )
  
file_path: recommenders/recommenders/models/sar/sar_singlenode.py
imports: import numpy
  import pandas
  import logging
  from scipy import sparse
  from recommenders.utils.python_utils import cosine_similarity, inclusion_index, jaccard, lexicographers_mutual_information, lift, mutual_information, exponential_decay, get_top_k_scored_items, rescale
  from recommenders.utils import constants
label_desc: Use image node_id 3 for calling the SARSingleNode obj's underlying member method code with example usage: obj.compute_time_decay(df, decay_column) and returns: df