# Name of transformation that maps numbers outside of interval onto endpoints?

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?

• 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 – David Jun 27 '19 at 11:54
• 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]$. – Nick Cox Jun 27 '19 at 11:58
• Yes, exactly. But I'm looking for the name... – ACNB Jun 27 '19 at 11:59
• I've seen this called clipping. I wouldn't vouch for that being a universal or even standard name, but it is available. – Nick Cox Jun 27 '19 at 13:27
• 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 – meduz Jun 28 '19 at 11:57

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.

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.

• 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. – Nick Cox Jun 27 '19 at 14:54
• @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. – whuber Jun 27 '19 at 14:58
• @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. – whuber Jun 27 '19 at 15:06
• Let's try to clamp down on clipping, then. – Nick Cox Jun 27 '19 at 15:35