You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by John Blythe <jo...@curvolabs.com> on 2016/12/19 19:32:53 UTC

Stats component's percentiles are incorrect

hi, all.

i've begun recruiting solr stats for some nifty little insights for our
users' data. it seems to be running just fine in most cases, but i have
noticed that there is a fringe group of results that seem to have incorrect
data.

for instance, one query returns the following output;

<lst name="stats">
<lst name="stats_fields">
<lst name="unitPrice">
<double name="min">3900.0</double>
<double name="max">4413.0</double>
<long name="count">102</long>
<arr name="distinctValues">
<double>3900.0</double>
<double>3998.0</double>
<double>4098.0</double>
<double>4200.0</double>
<double>4305.0</double>
<double>4413.0</double>
</arr>
<long name="countDistinct">6</long>
<double name="sum">439300.0</double>
<double name="sumOfSquares">1.89426839E9</double>
<double name="mean">4306.862745098039</double>
<double name="stddev">149.70552211193035</double>
<lst name="percentiles">
<double name="25.0">4305.0</double>
<double name="50.0">4413.0</double>
<double name="75.0">4413.0</double>
</lst>
</lst>
</lst>
</lst>

couple things to notice:

   - the 50th and 75%  are the same value as the max
   - the 50th and 75th % are the same number as one another

is there another setting i'm overlooking in the docs, is this a known bug,
or am i simply off the mark in my calculations/expectations?

thanks for any info-

Re: Stats component's percentiles are incorrect

Posted by John Blythe <jo...@curvolabs.com>.
very good point, walter. i think we could find some cool ways to leverage
this intelligence for our users after serving up the flattened version
based on the simple range that they're expecting to see. the clarity is
helpful in getting some creative ideas moving, so thanks.

best,

-- 
*John Blythe*
Product Manager & Lead Developer

251.605.3071 | john@curvolabs.com
www.curvolabs.com

58 Adams Ave
Evansville, IN 47713

On Mon, Dec 19, 2016 at 4:17 PM, Walter Underwood <wu...@wunderwood.org>
wrote:

> Percentiles are far more useful than that linear approximation. That is
> just slope and intercept, basically two numbers.
>
> With percentiles, I can answer the question “how fast is the search for
> 95% of my visitors?” With that linear interpolation, I don’t know anything
> about my customers.
>
> wunder
> Walter Underwood
> wunder@wunderwood.org
> http://observer.wunderwood.org/  (my blog)
>
>
> > On Dec 19, 2016, at 12:51 PM, John Blythe <jo...@curvolabs.com> wrote:
> >
> > gotcha. yup, that was the back up plan so i think i'll go that route for
> > now.
> >
> > thanks for the info!
> >
> > best,
> >
> > --
> > *John Blythe*
> > Product Manager & Lead Developer
> >
> > 251.605.3071 | john@curvolabs.com
> > www.curvolabs.com
> >
> > 58 Adams Ave
> > Evansville, IN 47713
> >
> > On Mon, Dec 19, 2016 at 3:41 PM, Toke Eskildsen <te...@statsbiblioteket.dk>
> > wrote:
> >
> >> John Blythe <jo...@curvolabs.com> wrote:
> >>> if the range is 0 to 100 then, for my current purposes, i don't care if
> >> the
> >>> vast majority of the values are 92, i would want 25%=>25, 50%=>50, and
> >>> 75%=>75. so is there an out-of-the-box way to get the percentiles to
> >>> correspond to the range itself rather than the concentration of
> distinct
> >>> values?
> >>
> >> Then it is not percentiles. And I don't know of any build-in function
> that
> >> returns them directly.
> >>
> >> But as you have the min and max, you can just do
> >> 25%: (max-min)*0.25+min
> >> 50%: (max-min)*0.5+min
> >> 75%: (max-min)*0.75+min
> >>
> >> But of course, that won't guarantee that you match the distinct values.
> If
> >> you want that, you'll have to iterate the list of distinct values (hope
> >> it's not too large) and pick out the nearest ones.
> >>
> >> - Toke Eskildsen
> >>
>
>

Re: Stats component's percentiles are incorrect

Posted by Walter Underwood <wu...@wunderwood.org>.
Percentiles are far more useful than that linear approximation. That is just slope and intercept, basically two numbers.

With percentiles, I can answer the question “how fast is the search for 95% of my visitors?” With that linear interpolation, I don’t know anything about my customers.

wunder
Walter Underwood
wunder@wunderwood.org
http://observer.wunderwood.org/  (my blog)


> On Dec 19, 2016, at 12:51 PM, John Blythe <jo...@curvolabs.com> wrote:
> 
> gotcha. yup, that was the back up plan so i think i'll go that route for
> now.
> 
> thanks for the info!
> 
> best,
> 
> -- 
> *John Blythe*
> Product Manager & Lead Developer
> 
> 251.605.3071 | john@curvolabs.com
> www.curvolabs.com
> 
> 58 Adams Ave
> Evansville, IN 47713
> 
> On Mon, Dec 19, 2016 at 3:41 PM, Toke Eskildsen <te...@statsbiblioteket.dk>
> wrote:
> 
>> John Blythe <jo...@curvolabs.com> wrote:
>>> if the range is 0 to 100 then, for my current purposes, i don't care if
>> the
>>> vast majority of the values are 92, i would want 25%=>25, 50%=>50, and
>>> 75%=>75. so is there an out-of-the-box way to get the percentiles to
>>> correspond to the range itself rather than the concentration of distinct
>>> values?
>> 
>> Then it is not percentiles. And I don't know of any build-in function that
>> returns them directly.
>> 
>> But as you have the min and max, you can just do
>> 25%: (max-min)*0.25+min
>> 50%: (max-min)*0.5+min
>> 75%: (max-min)*0.75+min
>> 
>> But of course, that won't guarantee that you match the distinct values. If
>> you want that, you'll have to iterate the list of distinct values (hope
>> it's not too large) and pick out the nearest ones.
>> 
>> - Toke Eskildsen
>> 


Re: Stats component's percentiles are incorrect

Posted by John Blythe <jo...@curvolabs.com>.
gotcha. yup, that was the back up plan so i think i'll go that route for
now.

thanks for the info!

best,

-- 
*John Blythe*
Product Manager & Lead Developer

251.605.3071 | john@curvolabs.com
www.curvolabs.com

58 Adams Ave
Evansville, IN 47713

On Mon, Dec 19, 2016 at 3:41 PM, Toke Eskildsen <te...@statsbiblioteket.dk>
wrote:

> John Blythe <jo...@curvolabs.com> wrote:
> > if the range is 0 to 100 then, for my current purposes, i don't care if
> the
> > vast majority of the values are 92, i would want 25%=>25, 50%=>50, and
> > 75%=>75. so is there an out-of-the-box way to get the percentiles to
> > correspond to the range itself rather than the concentration of distinct
> > values?
>
> Then it is not percentiles. And I don't know of any build-in function that
> returns them directly.
>
> But as you have the min and max, you can just do
> 25%: (max-min)*0.25+min
> 50%: (max-min)*0.5+min
> 75%: (max-min)*0.75+min
>
> But of course, that won't guarantee that you match the distinct values. If
> you want that, you'll have to iterate the list of distinct values (hope
> it's not too large) and pick out the nearest ones.
>
> - Toke Eskildsen
>

Re: Stats component's percentiles are incorrect

Posted by Toke Eskildsen <te...@statsbiblioteket.dk>.
John Blythe <jo...@curvolabs.com> wrote:
> if the range is 0 to 100 then, for my current purposes, i don't care if the
> vast majority of the values are 92, i would want 25%=>25, 50%=>50, and
> 75%=>75. so is there an out-of-the-box way to get the percentiles to
> correspond to the range itself rather than the concentration of distinct
> values?

Then it is not percentiles. And I don't know of any build-in function that returns them directly.

But as you have the min and max, you can just do
25%: (max-min)*0.25+min
50%: (max-min)*0.5+min
75%: (max-min)*0.75+min

But of course, that won't guarantee that you match the distinct values. If you want that, you'll have to iterate the list of distinct values (hope it's not too large) and pick out the nearest ones.

- Toke Eskildsen

Re: Stats component's percentiles are incorrect

Posted by John Blythe <jo...@curvolabs.com>.
mm, i was afraid something like that might be the case.

if the range is 0 to 100 then, for my current purposes, i don't care if the
vast majority of the values are 92, i would want 25%=>25, 50%=>50, and
75%=>75. so is there an out-of-the-box way to get the percentiles to
correspond to the range itself rather than the concentration of distinct
values?

thanks for any continued insight here!

-- 
*John Blythe*
Product Manager & Lead Developer

251.605.3071 | john@curvolabs.com
www.curvolabs.com

58 Adams Ave
Evansville, IN 47713

On Mon, Dec 19, 2016 at 3:12 PM, Toke Eskildsen <te...@statsbiblioteket.dk>
wrote:

> John Blythe <jo...@curvolabs.com> wrote:
> > <long name="count">102</long>
> ...
> > <long name="countDistinct">6</long>
>
> 102 values, but only 6 distinct (aka unique): 3900, 3998, 4098, 4200, 4305
> and 4413.
>
> > <lst name="percentiles">
> > <double name="25.0">4305.0</double>
> > <double name="50.0">4413.0</double>
> > <double name="75.0">4413.0</double>
>
> >   - the 50th and 75%  are the same value as the max
> >   - the 50th and 75th % are the same number as one another
>
> That is not a sign of an error. But it does tell us that at least half of
> your 102 values are 4413. Forgetting your 25% and your mean value for a
> moment, the 102 values could be
> 3900, 3998, 4098, 4200, 4305, 4413, 4413, 4413... (94 more repeats of
> 4413).
>
> - Toke Eskildsen
>

Re: Stats component's percentiles are incorrect

Posted by Toke Eskildsen <te...@statsbiblioteket.dk>.
John Blythe <jo...@curvolabs.com> wrote:
> <long name="count">102</long>
...
> <long name="countDistinct">6</long>

102 values, but only 6 distinct (aka unique): 3900, 3998, 4098, 4200, 4305 and 4413.

> <lst name="percentiles">
> <double name="25.0">4305.0</double>
> <double name="50.0">4413.0</double>
> <double name="75.0">4413.0</double>

>   - the 50th and 75%  are the same value as the max
>   - the 50th and 75th % are the same number as one another

That is not a sign of an error. But it does tell us that at least half of your 102 values are 4413. Forgetting your 25% and your mean value for a moment, the 102 values could be
3900, 3998, 4098, 4200, 4305, 4413, 4413, 4413... (94 more repeats of 4413).

- Toke Eskildsen