Skip to content

Percentile is innacurate with a small data set #24

@scott-david-walker

Description

@scott-david-walker

When calling Query using a small data set the actual underlying call to calculate the percentile is never used unless the stream has been flushed. It appears just to return the value in a certain index.

	q := quantile.NewTargeted(0.5, 0.9, 0.95, 0.99)
	q.Insert(float64(5340000000))
	q.Insert(float64(5750000000))
	q.Insert(float64(5930000000))
	q.Insert(float64(6160000000))
	q.Insert(float64(6560000000))
	q.Insert(float64(1156000000))
	fmt.Print(q.Query(0.50))  // 5750000000
	fmt.Print(q.Query(0.90)) // 6160000000
	fmt.Print(q.Query(0.95)) // 6160000000
	fmt.Print(q.Query(0.99)) // 6160000000

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions