5
$\begingroup$

I am looking for the term for a transformation that maps numbers outside of an interval onto the endpoints:

My interval is $[a,b]$. Any number $x < a$ will be transformed to $a$ and any number $y > b$ will be transformed to $b$.

Is there a term for these kind of functions?

$\endgroup$
  • $\begingroup$ It's definitely a piecewise-linear transformation (see en.wikipedia.org/wiki/Piecewise_linear_function#Examples) but I don't know if we can get more specific $\endgroup$ – David Jun 27 '19 at 11:54
  • $\begingroup$ I guess you mean $\max(a, \min(x, b))$ or $\min(\max(x, a), b) $ i.e. that $x$ is returned if within $[a, b]$. $\endgroup$ – Nick Cox Jun 27 '19 at 11:58
  • $\begingroup$ Yes, exactly. But I'm looking for the name... $\endgroup$ – ACNB Jun 27 '19 at 11:59
  • $\begingroup$ I've seen this called clipping. I wouldn't vouch for that being a universal or even standard name, but it is available. $\endgroup$ – Nick Cox Jun 27 '19 at 13:27
  • $\begingroup$ It is called the hardtanh in the ML community, though I do no know the origin of it. See for instance pytorch.org/docs/stable/nn.html#torch.nn.Hardtanh $\endgroup$ – meduz Jun 28 '19 at 11:57
3
$\begingroup$

It will depend on the context.

  • I recall the term "clamping" being used. It appears in various disciplines including numerical optimization and computer graphics.

  • In the computer graphics area this is needed to distinguish it from an important, ubiquitous, but different operation called "clipping"

  • Despite that, "clipping" is used in signal processing to denote your operation.

  • There is a closely allied operation in statistics called "Winsorizing". Winsorizing can be construed as beginning with a data-dependent clipping operation.

Graph

This graph of the "clipping" or "clamping" operation was created by plotting the function $x \to a \vee (b\wedge x)$ (where $\vee$ is the maximum and $\wedge$ is the minimum). It visually demonstrates that

  1. Clamping is piecewise linear.

  2. It can be construed as a special form of linear "spline" connecting the points $(a,a)$ and $(b,b).$ (Applying affine transformations to either or both coordinate will transform it into a linear spline between any pair of distinct points.) See https://stats.stackexchange.com/a/291598/919 for the theory and code.

$\endgroup$
  • $\begingroup$ WInsorizing is pulling inwards for pre-specified fractions of the values in the tails of a sample according to chosen fractions (e.g. the highest and lowest 5%; in general, fractions could differ, so that either fraction could be zero). It's not about clipping according to a pre-specified value or values. While it remains true that definitions can be made wide sense and extended beyond their first use, I think clipping is the better term here. $\endgroup$ – Nick Cox Jun 27 '19 at 14:54
  • $\begingroup$ @Nick Agreed. That is why I have not proposed that this operation actually is termed "Winsorizing." It looked useful to drag this concept into the discussion because it makes the applicability of the question to statistics a little more apparent. BTW, I have long preferred "clamping" for the name due to the overloading of "clipping" in related domains. $\endgroup$ – whuber Jun 27 '19 at 14:58
  • $\begingroup$ @Nick Hmm, I see the OP was not the person who added the winsorizing tag. I have rolled back that edit so this thread better reflects the original intentions. $\endgroup$ – whuber Jun 27 '19 at 15:06
  • 1
    $\begingroup$ Let's try to clamp down on clipping, then. $\endgroup$ – Nick Cox Jun 27 '19 at 15:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.