class QuantileSummaries extends Serializable
Helper class to compute approximate quantile summary. This implementation is based on the algorithm proposed in the paper: "Space-efficient Online Computation of Quantile Summaries" by Greenwald, Michael and Khanna, Sanjeev. (https://doi.org/10.1145/375663.375670)
In order to optimize for speed, it maintains an internal buffer of the last seen samples, and only inserts them after crossing a certain size threshold. This guarantees a near-constant runtime complexity compared to the original algorithm.
- Alphabetic
- By Inheritance
- QuantileSummaries
- Serializable
- Serializable
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
-
new
QuantileSummaries(compressThreshold: Int, relativeError: Double, sampled: Array[Stats] = Array.empty, count: Long = 0L, compressed: Boolean = false)
- compressThreshold
the compression threshold. After the internal buffer of statistics crosses this size, it attempts to compress the statistics together.
- relativeError
the target relative error. It is uniform across the complete range of values.
- sampled
a buffer of quantile statistics. See the G-K article for more details.
- count
the count of all the elements *inserted in the sampled buffer* (excluding the head buffer)
- compressed
whether the statistics have been compressed
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
def
compress(): QuantileSummaries
Returns a new summary that compresses the summary statistics and the head buffer.
Returns a new summary that compresses the summary statistics and the head buffer.
This implements the COMPRESS function of the GK algorithm. It does not modify the object.
- returns
a new summary object with compressed statistics
- val compressThreshold: Int
- var compressed: Boolean
- val count: Long
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
insert(x: Double): QuantileSummaries
Returns a summary with the given observation inserted into the summary.
Returns a summary with the given observation inserted into the summary. This method may either modify in place the current summary (and return the same summary, modified in place), or it may create a new summary from scratch it necessary.
- x
the new observation to insert into the summary
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
merge(other: QuantileSummaries): QuantileSummaries
Merges two (compressed) summaries together.
Merges two (compressed) summaries together.
Returns a new summary.
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
def
query(quantile: Double): Option[Double]
Runs a query for a given quantile.
Runs a query for a given quantile. The result follows the approximation guarantees detailed above. The query can only be run on a compressed summary: you need to call compress() before using it.
- quantile
the target quantile
- val relativeError: Double
- val sampled: Array[Stats]
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()