def plotAccuracy(suite, name):
  """
  Plots classification accuracy
  """
  path = suite.cfgparser.get(name, "path")
  path = os.path.join(path, name)

  accuracy = defaultdict(list)
  sensations = defaultdict(list)

  for exp in suite.get_exps(path=path):
    params = suite.get_params(exp)
    maxTouches = params["num_sensations"]
    cells = params["cells_per_axis"]

    res = suite.get_history(exp, 0, "Correct classification")
    classified = [any(x) for x in res]
    accuracy[cells] = float(sum(classified)) / float(len(classified))
    touches = [np.argmax(x) or maxTouches for x in res]
    sensations[cells] = [np.mean(touches), np.max(touches)]

  plt.title("Classification Accuracy")

  accuracy = OrderedDict(sorted(accuracy.items(), key=lambda t: t[0]))
  fig, ax1 = plt.subplots()
  ax1.plot(accuracy.keys(), accuracy.values(), "b")
  ax1.set_xlabel("Cells per axis")
  ax1.set_ylabel("Accuracy", color="b")
  ax1.tick_params("y", colors="b")

  sensations = OrderedDict(sorted(sensations.items(), key=lambda t: t[0]))
  ax2 = ax1.twinx()
  ax2.set_prop_cycle(linestyle=["-", "--"])
  ax2.plot(sensations.keys(), sensations.values(), "r")
  ax2.set_ylabel("Sensations", color="r")
  ax2.tick_params("y", colors="r")
  ax2.legend(("Mean", "Max"))

  # save
  path = suite.cfgparser.get(name, "path")
  plotPath = os.path.join(path, "{}.pdf".format(name))
  plt.savefig(plotPath)
  plt.close()
Plots classification accuracy