in reply to Re^2: How would you code this?
in thread How would you code this?
(i.e. after dropping some number of points from the input series, the middle point either falls midway between the other two, or creates an "elbow" close to the previous or following point).c c c vs b vs b b a a a
I thought about working out a way to maintain a stack, such that from the first (bottom) to the last (top) stack element, there would be at most three distinct x values (that seems to be the extent of the "oscillation" you're seeing).
Once a fourth x value appears in the next point, review the stack and output the points that comprise the smoothest trajectory. But that's a lot of work for a potentially insignificant gain in "accuracy".
UPDATE: As for your "primary" goal of "preserving the original data" as much as possible, as opposed to creating a smoothed sequence with adjustments affecting all data points: given that the input appears to be quantized, any desire to preserve that original data is actually going to preserve the nature of the measuring device, rather than the nature of the thing being measured. Maybe Certainly there's value in that, but depending on what your downstream processes are supposed to do with the data, you might rather let those processes get a "fully smoothed" version of the data, because this represents a presumably reasonable fiction, as opposed to the quantized, jagged fiction being created by your measuring device.
Another update: obviously, by preserving the original data - but not necessarily using it as-is for certain downstream processes - you'll get to do comparisons if/when you use a different device (or a different configuration of the current device).
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: How would you code this?
by BrowserUk (Patriarch) on Apr 07, 2016 at 15:25 UTC | |
by kennethk (Abbot) on Apr 07, 2016 at 16:14 UTC | |
by BrowserUk (Patriarch) on Apr 07, 2016 at 18:01 UTC | |
by kennethk (Abbot) on Apr 08, 2016 at 03:40 UTC | |
by BrowserUk (Patriarch) on Apr 08, 2016 at 19:24 UTC |