Chart of Representative Samples for a Chart

Example:
I have 100 samples over a period of time. But I can only use 10 values โ€‹โ€‹to build a line chart. What algorithm can I use to compute these 10 representative values โ€‹โ€‹so that the chart looks the same if I use all 100 accurate samples to draw it.

The naive algorithm that calculates the average for each of the next 10 samples does not reflect peaks in the chart very well.

+4
source share
1 answer

You can use the Douglas-Peucker algorithm to get the best performance without fetching.

The algorithm builds the set under the selection, starting from only the endpoints of the original data set. At each step, a point in the original data set is added to the set for the samples, which is the โ€œfarthestโ€ (maximum error) from the uncalibrated view. Thus, the algorithm includes important peaks in the original dataset and creates an undocumented representation of the minimum error.

Since you are allowed to use only 10 points in your set with insufficient sampling, you can configure the algorithm only to increase the set for the sample to size 10.

If you have an original dataset that includes too many peaks, you cannot capture them and satisfy the size limit.

Hope this helps.

+6
source

Source: https://habr.com/ru/post/1402038/


All Articles