Skip to content

Commit 55d05cd

Browse files
committed
messing with docstring
1 parent 7f40678 commit 55d05cd

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

pynumdiff/kalman_smooth/_kalman_smooth.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -266,25 +266,25 @@ def robustdiff(x, dt, order, log_q, log_r, proc_huberM=6, meas_huberM=0):
266266
:code:`convex_smooth`.
267267
268268
Note that for Huber losses, :code:`M` is the radius where the Huber loss function turns from quadratic to linear. Because
269-
all inputs to Huber are normalized by noise level, :code:`q` or :code:`r`, :code:`M` is in units of standard deviation.
270-
In other words, this choice affects which portion of inputs are treated as outliers. For example, assuming Gaussian inliers,
271-
the portion beyond :math:`M\\sigma` is :code:`outlier_portion = 2*(1 - scipy.stats.norm.cdf(M))`. The inverse of this is
272-
:code:`M = scipy.stats.norm.ppf(1 - outlier_portion/2)`. As :math:`M \\to \\infty`, Huber becomes the 1/2-sum-of-squares
273-
case, :math:`\\frac{1}{2}\\|\\cdot\\|_2^2`, and the normalization constant of the Huber loss approaches 1 as :math:`M`
274-
increases. (See :math:`c_2` `in section 6 <https://jmlr.org/papers/volume14/aravkin13a/aravkin13a.pdf>`_, missing a
275-
:math:`\\sqrt{\\cdot}` term there, see p2700). Similarly, as :code:`M` approaches 0, Huber reduces to the :math:`\\ell_1`
276-
norm case, because :math:`c_2` approaches :math:`\\frac{\\sqrt{2}}{M}`, cancelling the :math:`M` multiplying :math:`|\\cdot|`
277-
and leaving behind :math:`\\sqrt{2}`, the proper normalization.
269+
all inputs to Huber are normalized by noise level, :math:`q^{1/2}` or :math:`r^{1/2}`, :code:`M` is in units of standard
270+
deviation. In other words, this choice affects which portion of inputs are treated as outliers. For example, assuming
271+
Gaussian inliers, the portion beyond :math:`M\\sigma` is :code:`outlier_portion = 2*(1 - scipy.stats.norm.cdf(M))`. The
272+
inverse of this is :code:`M = scipy.stats.norm.ppf(1 - outlier_portion/2)`. As :math:`M \\to \\infty`, Huber becomes the
273+
1/2-sum-of-squares case, :math:`\\frac{1}{2}\\|\\cdot\\|_2^2`, and the normalization constant of the Huber loss (See
274+
:math:`c_2` `in section 6 <https://jmlr.org/papers/volume14/aravkin13a/aravkin13a.pdf>`_, missing a :math:`\\sqrt{\\cdot}`
275+
term there, see p2700) approaches 1 as :math:`M` increases. Similarly, as :code:`M` approaches 0, Huber reduces to the
276+
:math:`\\ell_1` norm case, because the normalization constant approaches :math:`\\frac{\\sqrt{2}}{M}`, cancelling the
277+
:math:`M` multiplying :math:`|\\cdot|` and leaving behind :math:`\\sqrt{2}`, the proper :math:`\\ell_1` normalization.
278278
279279
Note that :code:`log_q` and :code:`proc_huberM` are coupled, as are :code:`log_r` and :code:`meas_huberM`, via the relation
280-
:math:`\\text{Huber}(q^{-1/2}v, M) = q^{-1}\\text{Huber}(v, Mq^{-1/2})`, but they are still independent enough that for
280+
:math:`\\text{Huber}(q^{-1/2}v, M) = q^{-1}\\text{Huber}(v, Mq^{-1/2})`, but these are still independent enough that for
281281
the purposes of optimization we cannot collapse them.
282282
283283
:param np.array[float] x: data series to differentiate
284284
:param float dt: step size
285285
:param int order: which derivative to stabilize in the constant-derivative model (1=velocity, 2=acceleration, 3=jerk)
286-
:param float log_q: base 10 logarithm of the process noise level, so :code:`q = 10**log_q`
287-
:param float log_r: base 10 logarithm of the measurement noise level, so :code:`r = 10**log_r`
286+
:param float log_q: base 10 logarithm of the process noise variance, so :code:`q = 10**log_q`
287+
:param float log_r: base 10 logarithm of the measurement noise variance, so :code:`r = 10**log_r`
288288
:param float proc_huberM: quadratic-to-linear transition point for process loss
289289
:param float meas_huberM: quadratic-to-linear transition point for measurement loss
290290

0 commit comments

Comments
 (0)