Plotting with Torch7


Actually, dygraph/NVD3 provides the best plotting facilities. Yet, they are a bit technical and they are heavy to implement. So, use them if you need interactive plotting with complex data. In addition, you need to be a bit familiar with web development.

Bokeh/iTorch provides the best tool out-of the box. It is easy to use and it has nice figures. Yet, you may be a bit limited if you want advanced stuff. If a new wrapper is developed, I think this API may become the best one to use.

If you are a gnuplot expert. Keep using to it. Gnuplot is powerful even if it is a bit old-fashioned. It still does the work very well. Otherwise, prefer Bokeh/iTorch.

3 Comments on “Plotting with Torch7

  1. Great,
    I would like to ask if there is a way how to compute Recall and precision from a confusion matrix and draw them if it is possible. I am facing this problem for more than a month but I could not find an answer. So, please help.

    • Sure!
      First, you can compute your confusion matrix my using the optim package:

      Then, if you want to plot accuracy/recall upon time, Dygraph/Display is a good library

      For every steps:
      – Compute the Precision/Recall from your confusion matrix
      \text{Precision}=\frac{tp}{tp+fp} \,
      \text{Recall}=\frac{tp}{tp+fn} \,

      – Plot it !

      Lua code:

      local labels = {"epoch", 'accuracy', 'recall'}
      local data = {}

      local config =
      title = "Global accuracy/recall upon time",
      labels = labels,
      ylabel = "ratio",

      for t = 1, noEpoch do

      local accuracy, recall = someFct()

      table.insert(data, {t, accuracy, recall })

      -- display = disp.plot(data, config)


      • Hi
        Many thanks for replying but I try it many times but did not work with. Could you please give me more intuition about the code.

Leave a Reply

Your email address will not be published.