From what I understand it's a fixed size data structure, represents quantiles as a tree of histogram bands, pruning nodes with densities that vary the least from their parents to achieve error / size trade-off. They also have the property that you can merge them together and re-compress in order to turn second data into minute data, or compress more accurate (large) archival digests into smaller ones to say, support stable streaming of a varying number of metrics across a stream of varying bandwidth by sacrificing quality.
They're pretty simple because they're designed for sensor networks, but I think you could design similar structures with a dynamic instead of fixed value range, and variable size (prune nodes based on error threshold instead of or in addition to desired size).
If anyone knows of a time-series system using something like this, I'd love to learn about it.
(Better yet, just give me the raw data so I can analyze it myself. I find it hard to blindly trust someone else's conclusions considering all of the p-hacking going on nowadays.)
The system would then load the data from S3 back into the live system via Hadoop. Turns out it was pretty cheap to store highly compressible files in S3.
(Do NOT, for the love of your sanity, emulate this design exactly. Use Backblaze or Google's nearline storage. Do not touch Glacier at all if you can avoid it. When I wrote the Glacier integration, I did it because it was far cheaper than its competitors. That's no longer the case.)
FYI I don't think its right to say "forget means, medians, percentiles, etc." They are hugely useful.
You just have to note that they aren't everything. As you've noted, only the raw data is everything.
If you're saying that people should provide the full data along with their analysis, I fully agree! But if you're saying "skip the analysis", then unfortunately I, and most people, are not statistically educated enough to do all the analysis ourselves.
Always keep in mind that estimating distributions from samples is very hard, in particular for multidimensional and continuous variables. Sometimes even infinite samples do not suffice (I am not kidding).
The good news is that there are interesting and relevant tasks (for example classification) where you do not need to know the distribution to solve the task optimally, although if you somehow managed to do so (find the distribution) you would be able to solve the task optimally. Or more succinctly, knowing the distribution is sufficient but not necessary for such tasks (small mercies)
http://www.siegfried-kettlitz.de/blog/posts/2015/11/28/linlo...
If you have questions or comments, feel free to reply or email.
E.g. estimating the P99 from 200 data points each will give you a large variation. In this case averaging will be wrong. This gets worse if you experience bunching. E.g. a server will have a high ping on several packets when the load is high; after that it will have a low ping for thousands of packets when the load is low. Here, it just doesn't work.
Instead, you can get a better result by adding the (estimated) histograms and resampling the quantiles from the combined distribution function.
Here I've written how that works with a live demonstration: http://www.siegfried-kettlitz.de/blog/posts/2015/11/28/linlo...
The problem you talk about is one of granularity: you don't want to know how bad things are in general, you want to know how bad things are when they are actually bad. That's perfectly legitimate, but it's a different metric altogether that just happens to also be based off of the 99th percentile. It depends on your definition of "the distribution".
This probably sounds like nitpicking, but people should know what they're talking about when they call out others for being wrong.
Are you sure about this?
x <- rnorm(1000, mean=50, sd=10)
quantile(x, 0.99)
mean(sapply(1:20, function(i) {
i <- i * 50
quantile(x[i-49:i], 0.99)
})) rand('seed',123);
outer_rounds = 100;
inner_rounds = 100;
items = 500;
q99_mean_vec = [];
q99_complete_vec = [];
for ior = 1:outer_rounds;
q99_vec = [];
x = rand( 1, rounds*items );
for iir = 1:inner_rounds
q99_vec(iir) = quantile( x( (iir-1)*items+(1:items) )', 0.99 );
end
q99_complete_vec(ior) = quantile( x', 0.99 );
q99_mean_vec(ior) = mean( q99_vec' );
end
hist( [ q99_complete_vec; q99_mean_vec ]', [0.988:0.0001:0.991] );
xlim( [0.988, 0.991] );
legend( 'from complete data', 'from means' );
This looks biased to me even though the distribution is uniform. I did not expect that. Maybe the quantile function is broken.EDIT: I've installed R and run your code. You use a very low number of samples in the mean, so I changed it a bit. 1. I use the uniform distribution, so we know the true value of the 99th percentile is 0.99. 2. I've increased the number of samples:
x <- runif(100000)
quantile(x, 0.99)
mean(sapply(1:2000, function(i) {
i <- i * 50
quantile(x[i-49:i], 0.99)
}))
When run multiple times, I've found that the mean is always lower than the quantile over the full sample.Perhaps I'm wrong, but whenever I'm looking at the tail of a distribution, it's usually just to understand the order of magnitude, not to reach a precise number.
The problem with that is, sometimes the top 2% you are discarding might correlate to your top 2% of customers...and you are literally throwing their data away by using percentiles. Not good.
My recommendation is to pick two aggregation types. Maybe Percentile and Maximum, or Maximum and Mean, or Percentile and Mean. You can't really go wrong with that approach.
I suspect that's what the parent post was referring to and I would agree: percentile calculations do work the way I think, and the article didn't say anything controversial.