def accuracy(current, predicted):
  """
  Computes the accuracy of the TM at time-step t based on the prediction
  at time-step t-1 and the current active columns at time-step t.
  
  @param current (array) binary vector containing current active columns
  @param predicted (array) binary vector containing predicted active columns  
  @return acc (float) prediction accuracy of the TM at time-step t
  """  
  acc = 0
  if np.count_nonzero(predicted) > 0:
    acc = float(np.dot(current, predicted))/float(np.count_nonzero(predicted))
  return acc
Computes the accuracy of the TM at time-step t based on the prediction
  at time-step t-1 and the current active columns at time-step t.
  
  @param current (array) binary vector containing current active columns
  @param predicted (array) binary vector containing predicted active columns  
  @return acc (float) prediction accuracy of the TM at time-step t