in reply to Re: How would you code this?
in thread How would you code this?
Graff. You've certainly given me considerable food for thought. And a bunch of extra work to do. So "Thank you" and "thaaaanks a bunch" :)
Here is a composite zoom on the 5 differences between your output and mine.
- Top left: You're algorithm picks two points to the left of the two mine picks.
I think the ideal would be to pick my first point, your second point and the point slap bang in between all four points; but I see no algorithm that would make that choice without hard coding a special case.
In the end, I think either chosen pair is equally valid.
- Top right: Your algorithm retains one extra point that happens fall almost exactly on the line between the two points mine retains.
I concur with you that discarding less is a good thing; in this case, I think the difference would be negligible.
- Bottom left: Your's retains two extra points.
The upper extra point is much the same as the previous; negligible difference beyond keeping an extra point.
The lower extra point, the difference is bigger, more significant.
- Lower right (inset): Two extra points; the difference about the same as the lower point above.
I'm undecided if these differences are important; but they are extra points retained, which I like.
One of, if not the, primary goals of using a discrete filter algorithm, rather than a continuous fitting or smoothing algorithm, is the desire to retain as much of the actual data as possible. Continuous algorithms like moving average, 3-point median and Loess, all have affects upon all the points, not just those at and around the discontinuities; often inventing new points, and subtly shifting existing points well away from the discontinuities; and they also don't guarantee to remove all inflections.
Upshot: I'm going to have to run your algorithm against mine on a few much larger samples and check to ensure that there are no significant downsides to your algorithm. If not, I will be dumping mine in favour of yours.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: How would you code this?
by graff (Chancellor) on Apr 07, 2016 at 14:04 UTC | |
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 | |
|