public class UniformDoubleDistribution extends Object implements DataDistribution
| Constructor and Description |
|---|
UniformDoubleDistribution() |
UniformDoubleDistribution(double min,
double max) |
| Modifier and Type | Method and Description |
|---|---|
DoubleValue[] |
getBucketBoundary(int bucketNum,
int totalNumBuckets)
Returns the i'th bucket's upper bound, given that the distribution is to be
split into
totalBuckets buckets. |
int |
getNumberOfFields()
The number of fields in the (composite) key.
|
void |
read(DataInputView in)
Reads the object's internal data from the given data input view.
|
void |
write(DataOutputView out)
Writes the object's internal data to the given data output view.
|
public UniformDoubleDistribution()
public UniformDoubleDistribution(double min,
double max)
public DoubleValue[] getBucketBoundary(int bucketNum, int totalNumBuckets)
DataDistributiontotalBuckets buckets.
Assuming n buckets, let B_i be the result from calling getBucketBoundary(i, n),
then the distribution will partition the data domain in the following fashion:
(-inf, B_1] (B_1, B_2] ... (B_n-2, B_n-1] (B_n-1, inf)
Note: The last bucket's upper bound is actually discarded by many algorithms.
The last bucket is assumed to hold all values v such that
v > getBucketBoundary(n-1, n), where n is the number of buckets.
getBucketBoundary in interface DataDistributionbucketNum - The number of the bucket for which to get the upper bound.totalNumBuckets - The number of buckets to split the data into.public int getNumberOfFields()
DataDistributionDataDistribution.getBucketBoundary(int, int).getNumberOfFields in interface DataDistributionpublic void write(DataOutputView out) throws IOException
IOReadableWritablewrite in interface IOReadableWritableout - the output view to receive the data.IOException - thrown if any error occurs while writing to the output streampublic void read(DataInputView in) throws IOException
IOReadableWritableread in interface IOReadableWritablein - the input view to read the data fromIOException - thrown if any error occurs while reading from the input streamCopyright © 2014–2016 The Apache Software Foundation. All rights reserved.