1
$\begingroup$

when transforming data to log scale for charting purposes, is it more "correct" in some way to always transform using log(x+1) (henceforth referred to as log1p following numpy/python convention) than with log(x) and does it break any common user expectations?

I understand that log(x+1) will have better numerical stability if the numbers are close to 0, for instance if they are say a loss metric in DL. in such cases log1p could be a better choice. which of these design choices are more valid?

  1. always use log1p to compute the transformation
  2. use some heuristic to select between log1p and log depending on the name of the metric and/or the range of values (how close to 0 the values get)
  3. put the burden on the user to select between log1p and log (I've never seen any code-free software do that)
$\endgroup$
2
  • $\begingroup$ It's unclear what you mean by np.log1p, but I presume it's something like adding a constant to the argument before taking the logarithm. $\endgroup$ – whuber Jan 31 at 18:42
  • $\begingroup$ @whuber clarified that log1p is log(x+1) following python/numpy conventions $\endgroup$ – Aviad Rozenhek Feb 1 at 8:29