Struct quantogram::QuantogramBuilder
source · [−]pub struct QuantogramBuilder { /* private fields */ }Expand description
A fluent API Builder for Quantograms.
If error, growth or bins_per_doubling are changed, the other two are modified to be consistent with it. If error or growth imply a non-integral value for bins_per_doubling, take the ceiling of the derived bins_per_ceiling and rederive the other two from that, to satisfy a minimum guarantee.
No values may cause bins_per_doubling to exceed 1000, hence the error may not be set lower than 0.0347%.
Example of creating a Quantogram with a maximum of 2% absolute relative error:
use quantogram::QuantogramBuilder; let q = QuantogramBuilder().with_error(0.02).build();
This is the number of bins used for various error rates:
Bins Error Rate
---- ----------
2 17.2 %
3 11.5 %
4 8.6 %
5 6.9 %
7 4.9 %
12 2.9 %
18 1.9 %
35 1.0 %
70 0.5 %
139 0.25%
347 0.10%
694 0.05%
867 0.04%
1000 0.0347%Implementations
Create a new builder that defaults to an error rate of 1% with 35 bins per doubling and a growth factor of 1.02.
Build a Quantogram using the collected configuration values.
Configure the underflow of samples. A sample whose magnitude has a power of two less than the given values will be set to zero.
Example: If you only need to compute quantiles to two decimal places:
set power = -7, since 2^-7 = 1/128 < 0.01.Configure the overflow of samples. A sample whose magnitude has a power of two greater than the given values will be set to +/- Infinity.
Example: If you only need to study numbers below a thousand, set power = 10, since 2^10 = 1024 > 1000.
Configure to target the given maximum absolute relative error.
Configure to target the given growth factor from one bucket to the next. This will be adjusted to the nearest value that is an Nth root of 2.
Set bins_per_doubling, error, and growth to be consistent with the given value. Memory usage is proportional to this value, so this is the way to directly control memory usage. A bins_per_doubling value of 35 yields 1% error.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for QuantogramBuilder
impl Send for QuantogramBuilder
impl Sync for QuantogramBuilder
impl Unpin for QuantogramBuilder
impl UnwindSafe for QuantogramBuilder
Blanket Implementations
Mutably borrows from an owned value. Read more