Open HeinrichHaller opened 2 weeks ago
Good point about that non-causality, that should be indeed resolved. Do you find it important to use that Gaussian kernel? Personally I wouldn't be against applying that dual pole filter on this section again to keep it simple.
Yes. As intermediate I would go that route as well. I would use the dual pole filter again(There are a lot of adequate candidates out there like mama/fama from talib etc you could use as well). The rolling kernel regression with gaussian or rational quadratic kernel do have a quality of its own and are worth being implemented though. Do you need help with those? I shows that loops are far from being obsolete or un-pythonic. Loops have an inbuilt sanity check.
The gaussian_filter1d function from the scipy.ndimage module, when applied to a time series, is probably not strictly causal because it applies the Gaussian smoothing both forward and backward from each point in the series. This means that the output at any given time point is influenced by data from both the past and the future relative to that point.
series_smooth = gaussian_filter1d(slow, sigma=gaussian_sigma)
I think what is done by jdherty here is a rolling kernel regression with a
def gaussian_kernel(x, y, h, **kwargs): distances = cdist(x, y, 'sqeuclidean') return np.exp(-distances / (2 * h ** 2))
kernel. This is needed to not cause 'repainting' as well. Thanks for having a look at it!