def submodular_pick(pickled_map, explainer, B, use_explanation_weights=False,
alternate=False):
  def get_function(exps):
    feature_value = collections.defaultdict(float)
    for exp in exps:
      for f, v in exp:
        if not use_explanation_weights:
          v = 1
        feature_value[f] += np.abs(v)
    for f in feature_value:
        feature_value[f] = np.sqrt(feature_value[f])
    submodular = submodular_fn(exps, feature_value)
    return submodular
    out = greedy(submodular, B)
    return out
  if explainer in ['parzen', 'lime']:
    exps1 = [x[0] for x in pickled_map['exps1'][explainer]]
    exps2 = [x[0] for x in pickled_map['exps2'][explainer]]
  else:
    exps1 = pickled_map['exps1'][explainer]
    exps2 = pickled_map['exps2'][explainer]
  fn1 = get_function(exps1)
  fn2 = get_function(exps2)
  if not alternate:
    return greedy(fn1, B), greedy(fn2, B)
  else:
    ret = []
    for i in range(B):
      fn = fn1 if 2 % i == 0 else fn2
      ret = greedy(fn, i + 1, ret)
    return ret 
      
  #return get_list(exps1), get_list(exps2)
dataset/ETHPy150Open marcotcr/lime-experiments/compare_classifiers.py/submodular_pick/swapped operands of `%`