Skip to content

Commit d039ab8

Browse files
committed
added huberM param to optimizer
1 parent 03b963e commit d039ab8

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

pynumdiff/optimize/_optimize.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,10 @@
6565
{'sigma': (1e-2, 1e3),
6666
'lmbd': (1e-3, 0.5)}),
6767
tvrdiff: ({'gamma': [1e-2, 1e-1, 1, 10, 100, 1000],
68-
'order': {1, 2, 3}}, # warning: order 1 hacks the loss function when tvgamma is used, tends to win but is usually suboptimal choice in terms of true RMSE
69-
{'gamma': (1e-4, 1e7)}),
68+
'order': {1, 2, 3}, # warning: order 1 hacks the loss function when tvgamma is used, tends to win but is usually suboptimal choice in terms of true RMSE
69+
'huberM': [0., 1, 2, 3, 6]},
70+
{'gamma': (1e-4, 1e7),
71+
'huberM': (0, 6)}),
7072
velocity: ({'gamma': [1e-2, 1e-1, 1, 10, 100, 1000]}, # Deprecated method
7173
{'gamma': (1e-4, 1e7)}),
7274
iterative_velocity: ({'scale': 'small', # Rare to optimize this one, because it's longer-running than convex version

pynumdiff/utils/utility.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,10 @@ def estimate_integration_constant(x, x_hat, M=6):
130130
131131
:param np.array[float] x: timeseries of measurements
132132
:param np.array[float] x_hat: smoothed estimate of x
133-
:param float M: constant estimation is robustified with the Huber loss. The default is intended to capture the idea
134-
of "six sigma": Assuming Gaussian :code:`x - xhat` errors and :code:`M` in units of standard deviation, the
135-
portion of inliers beyond the Huber loss' transition is only about 1.97e-9. :code:`M` here is in units of scaled
136-
mean absolute deviation, so scatter can be calculated and used to normalize without being thrown off by outliers.
133+
:param float M: constant estimation is robustified with the Huber loss. :code:`M` here is in units of scaled
134+
mean absolute deviation of residuals, so scatter can be calculated and used to normalize without being
135+
thrown off by outliers. The default is intended to capture the idea of "six sigma": Assuming Gaussian
136+
:code:`x - xhat` errors, the portion of inliers beyond the Huber loss' transition is only about 1.97e-9.
137137
138138
:return: **integration constant** (float) -- initial condition that best aligns x_hat with x
139139
"""

0 commit comments

Comments
 (0)