turicreate.aggregate.QUANTILE

turicreate.aggregate.QUANTILE(src_column, *args)

Builtin approximate quantile aggregator for groupby. Accepts as an argument, one or more of a list of quantiles to query. For instance:

To extract the median

>>> sf.groupby("user",
...   {'rating_quantiles':tc.aggregate.QUANTILE('rating', 0.5)})

To extract a few quantiles

>>> sf.groupby("user",
...   {'rating_quantiles':tc.aggregate.QUANTILE('rating', [0.25,0.5,0.75])})

Or equivalently

>>> sf.groupby("user",
...     {'rating_quantiles':tc.aggregate.QUANTILE('rating', 0.25,0.5,0.75)})

The returned quantiles are guaranteed to have 0.5% accuracy. That is to say, if the requested quantile is 0.50, the resultant quantile value may be between 0.495 and 0.505 of the true quantile.