def submodular_fn(explanations, feature_value):
  """TODO: Detail this"""
  z_words = set()
  for exp in explanations:
    z_words = z_words.union([x[0] for x in exp])
  normalizer = sum([feature_value[w] for w in z_words])
  def fnz(x):
    all_words = set()
    for doc in x:
      all_words = all_words.union([x[0] for x in explanations[doc]])
    return sum([feature_value[w] for w in all_words]) / normalizer
  fnz.num_items = len(explanations)
  return fnz
dataset/ETHPy150Open marcotcr/lime-experiments/compare_classifiers.py/submodular_fn/original