Derivation of the Cost Function

Here's how the cost function as presented here
<https://docs.google.com/document/d/1kx62tpy5hGIbHh6tHMAryon9Sgye--W_IsHTeCMlmEo/edit#heading=h.4fz1x8661i63>
was
derived:


   - Start with the logistic function (a sigmoid): M/ ( 1 + e^(-k(x - x_0)))
   - M is the maximum height of the function.
   - k scales the width of the function
   - and x_0 shifts the function left/right.

We want a function that starts rising at x = T_z and hits it's maximum at
T_m:

   - Width of the period it rises over is W = T_m - T_z
   - Scale k = K / W. Where K is a hand selected constant which controls
   the width. By dividing by W we normalize the scale against the width. A
   value of K = 11.5 was found to give a near maximum and minimum value at T_z
   and T_m.
   - x_0 = W/2 + T_z = T_m/2 - T_z/2 + T_z = T_m/2 + T_z/2
      -  This moves the function W/2 units to the right (the logistic
      function starts centered on x = 0)
      - And then an additional T_z to the right to add the initial period
      of zero cost.

If you plug that all into M / (1 + e^(-k(x - x_0))) you get:

M / ( 1 + e^(-11.5/(T_m-T_z) * ( x - T_m/2 - T_z/2)))

There's a similar explanation in the actual implementation in code:
https://github.com/w3c/PFE-analysis/blob/master/analysis/cost.py

Received on Tuesday, 6 October 2020 23:31:01 UTC