类 QuantileSummary
- java.lang.Object
-
- org.apache.flink.ml.common.util.QuantileSummary
-
- 所有已实现的接口:
Serializable
@TypeInfo(QuantileSummaryTypeInfoFactory.class) public class QuantileSummary extends Object implements Serializable
Helper class to compute an 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)- 另请参阅:
- 序列化表格
-
-
嵌套类概要
嵌套类 修饰符和类型 类 说明 static classQuantileSummary.StatsTupleWrapper class to hold all statistics from the Greenwald-Khanna paper.
-
构造器概要
构造器 构造器 说明 QuantileSummary()Empty QuantileSummary Constructor.QuantileSummary(double relativeError)QuantileSummary Constructor.QuantileSummary(double relativeError, int compressThreshold)QuantileSummary Constructor.QuantileSummary(double relativeError, int compressThreshold, List<QuantileSummary.StatsTuple> sampled, long count, boolean compressed)QuantileSummary Constructor.
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 QuantileSummarycompress()Returns a new summary that compresses the summary statistics and the head buffer.intgetCompressThreshold()longgetCount()List<Double>getHeadBuffer()doublegetRelativeError()List<QuantileSummary.StatsTuple>getSampled()QuantileSummaryinsert(double item)Insert a new observation into the summary.booleanisCompressed()booleanisEmpty()Checks whether the QuantileSummary has inserted rows.QuantileSummarymerge(QuantileSummary other)Merges two summaries together.doublequery(double percentile)Runs a query for a given percentile.double[]query(double[] percentiles)Runs a query for a given sequence of percentiles.
-
-
-
构造器详细资料
-
QuantileSummary
public QuantileSummary()
Empty QuantileSummary Constructor.
-
QuantileSummary
public QuantileSummary(double relativeError)
QuantileSummary Constructor.- 参数:
relativeError- The target relative error.
-
QuantileSummary
public QuantileSummary(double relativeError, int compressThreshold)QuantileSummary Constructor.- 参数:
relativeError- The target relative error.compressThreshold- the compression threshold. After the internal buffer of statistics crosses this size, it attempts to compress the statistics together.
-
QuantileSummary
public QuantileSummary(double relativeError, int compressThreshold, List<QuantileSummary.StatsTuple> sampled, long count, boolean compressed)QuantileSummary Constructor.- 参数:
relativeError- The target relative error.compressThreshold- the compression threshold.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.compressed- Whether the statistics have been compressed.
-
-
方法详细资料
-
insert
public QuantileSummary insert(double item)
Insert a new observation into the summary.- 参数:
item- The new observation to insert into the summary.- 返回:
- A summary with the given observation inserted into the summary.
-
compress
public QuantileSummary compress()
Returns a new summary that compresses the summary statistics and the head buffer.This implements the COMPRESS function of the GK algorithm.
- 返回:
- The compressed summary.
-
merge
public QuantileSummary merge(QuantileSummary other)
Merges two summaries together.- 参数:
other- The summary to be merged.- 返回:
- The merged summary.
-
query
public double query(double percentile)
Runs a query for a given percentile. The query can only be run on a compressed summary, you need to call compress() before using it.- 参数:
percentile- The target percentile.- 返回:
- The corresponding approximate quantile.
-
query
public double[] query(double[] percentiles)
Runs a query for a given sequence of percentiles. The query can only be run on a compressed summary, you need to call compress() before using it.- 参数:
percentiles- A list of the target percentiles.- 返回:
- A list of the corresponding approximate quantiles, in the same order as the input.
-
isEmpty
public boolean isEmpty()
Checks whether the QuantileSummary has inserted rows. Running query on an empty QuantileSummary would causeIllegalStateException.- 返回:
- True if the QuantileSummary is empty, otherwise false.
-
getRelativeError
public double getRelativeError()
-
getCompressThreshold
public int getCompressThreshold()
-
getCount
public long getCount()
-
getSampled
public List<QuantileSummary.StatsTuple> getSampled()
-
isCompressed
public boolean isCompressed()
-
-