Skip to content
All library documents

Piecewise Scaling for Scores Above a Median-Based Cap

Article Quant Q&A · Author: Gracie williams

Summary

The document describes how to extend a capped, median-based normalization scheme so values below a chosen upper limit map to scores from 0 to 10, while values above that limit rise toward 20. The first segment scales values proportionally to the upper limit; the second maps values between that limit and a specified maximum onto the higher score range. This creates a continuous piecewise mapping and avoids assigning the same maximum score to every value above the cap.

The explanation gives a formula and a JavaScript sketch, using example values to illustrate the intended behavior. The approach depends on choosing a meaningful upper limit and maximum value: scores at or beyond the maximum need explicit handling if values can exceed it, and the mapping's usefulness depends on the data distribution. It offers a general scoring transformation, not a trading signal or evidence that the resulting scores improve investment decisions.

Key ideas

  • A piecewise linear mapping can preserve proportional scores below a threshold and spread larger values across a second range.
  • The first segment maps values up to the upper limit onto scores from zero to ten.
  • The second segment maps values from the upper limit toward a selected maximum onto scores from ten to twenty.
  • The selected maximum determines how quickly scores rise above the threshold.

Tags

Full text
# Custom normalisation from 0 to 20


# Custom normalisation from 0 to 20












I want to normalise from 0 to 20

For example right now I do normalisation with dynamic outlier exclusion , using median.

So it works fine for some values like below

```
[100,200,19,0,200,200,12,19000,14000]
```

It is converted to

```
 [5, 10, 0.95, 0, 10, 0.6, 10, 10]
```

Which is good , I want do normalisation of values greater than median value which give score of 11 to 20 , Something like

```
  [5, 10, 0.95, 0, 10, 0.6, 20 , 16]
```

This is the code I use right now

```
   var upper_lim = median*2;
   var test =   10*Math.min(value, upper_lim )/upper_lim;
```

## Answer by Attack68 (score 1, accepted)

https://quant.stackexchange.com/a/50242

Essentially you are creating a mapping, or a function here.

In the first instance you had a maximal score of 10, and you mapped as follows:

$$f(volume) = \left \{ \begin{matrix} 10* volume/200, \quad volume < 200 \\ 10 * 1, \quad volume \geq 200 \end{matrix} \right .$$

You have coded this in JS as (where 200 is `upper_lim`):

```
var test =   10*Math.min(value, upper_lim )/upper_lim;
```

Now you have redefined your mapping to the following:

$$f(volume) = \left \{ \begin{matrix} 10* \frac{volume}{200}, \quad volume < 200 \\ 10 * (1 + \frac{volume-200}{19000-200}), \quad volume \geq 200 \end{matrix} \right .$$

where 19000 is `max_volume`. The maximum value this function can take is 20.

```
var test;
if (value < upper_lim)  {
  test = 10 * value / upper_limit 
} else {
  test = 10 * ( 1 + (value-upper_limit)/(max_value-upper_limit) )
}
```

Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.