Expand description
ArrayOfDoubles Tuple sketch family: cardinality estimation where each
retained key also carries a fixed-width array of f64 values, summed on
collision.
use apache_datasketches::tuple::ArrayOfDoublesSketchBuilder;
let mut sketch = ArrayOfDoublesSketchBuilder::new().num_values(2).build()?;
sketch.update_u64(42, &[1.0, 2.5])?;
println!("estimate: {}", sketch.get_estimate());ArrayOfDoublesSketch/ArrayOfDoublesSketchBuilder— the updatable sketch.CompactArrayOfDoublesSketch— an immutable, serializable snapshot produced byArrayOfDoublesSketch::compactor by a set operation’s result.ArrayOfDoublesUnion/ArrayOfDoublesUnionBuilder— merges multiple sketches, summing values per index on collision.ArrayOfDoublesIntersection— computes the intersection of sketches fed viaupdate, summing values per index.ArrayOfDoublesAnotB— computes the set difference (keys inabut notb), preservinga’s values.array_of_doubles_jaccard_similarity/JaccardBounds— estimates the Jaccard index (intersection-over-union) of two sketches.generic— Tuple sketches over a summary type you define yourself, for cases the fixedf64-array shape above does not cover.
ArrayOfDoublesSketch and CompactArrayOfDoublesSketch can both be
passed interchangeably (via the sealed ArrayOfDoublesInput trait) to
every set operation in this module.
Modules§
- generic
- Generic Tuple sketches: cardinality estimation where each distinct key carries a summary of a type you define.
Structs§
- Array
OfDoubles AnotB - Computes the set difference (“A not B”: keys in
abut notb) of two ArrayOfDoubles sketches viaSelf::compute. Retained entries keepa’s values unchanged. Stateless between calls — unlikesuper::ArrayOfDoublesUnion/super::ArrayOfDoublesIntersection, there is no accumulation across repeated calls. - Array
OfDoubles Intersection - Computes the intersection of ArrayOfDoubles sketches fed via
Self::update. Values are summed per index for keys present in every input. - Array
OfDoubles Sketch - A mutable, update-only ArrayOfDoubles Tuple sketch: estimates the number
of distinct keys added via
update_*, and carries a fixed-width array off64values per retained key, summed on collision. Build one withArrayOfDoublesSketchBuilder. - Array
OfDoubles Sketch Builder - Builder for
crate::tuple::ArrayOfDoublesSketch, mirroring upstream’supdate_array_of_doubles_sketch::builder.lg_kdefaults to12,resize_factortoResizeFactor::X8,pto1.0(no sampling), andnum_valuesto1(matching upstream’sdefault_array_tuple_update_policydefault). The seed is never exposed — every sketch built by this crate uses upstream’sDEFAULT_SEED. - Array
OfDoubles Union - A streaming union accumulator over ArrayOfDoubles sketches. Values are
summed per index when the same key appears in more than one input, using
upstream’s
default_array_of_doubles_union_policy. - Array
OfDoubles Union Builder - Builder for
ArrayOfDoublesUnion, mirroring upstream’sarray_of_doubles_union::builder.lg_kdefaults to12,resize_factortoResizeFactor::X8,pto1.0(no sampling), andnum_valuesto1. As withArrayOfDoublesSketchBuilder, the seed is never exposed. - Compact
Array OfDoubles Sketch - An immutable, serializable snapshot of an ArrayOfDoubles Tuple sketch.
Produced by
super::ArrayOfDoublesSketch::compact, by any set operation’s result, or bySelf::deserialize. - Jaccard
Bounds - The result of a Tuple Jaccard similarity computation — returned by both
array_of_doubles_jaccard_similarityandtuple_jaccard_similarity: a confidence interval around the estimated Jaccard index of two sketches, in[0.0, 1.0].
Enums§
- Resize
Factor - Controls how aggressively an ArrayOfDoubles sketch’s internal hash table
grows. Mirrors upstream’s
datasketches::resize_factor. Default isX8, matchingtheta_constants::DEFAULT_RESIZE_FACTOR(the tuple family inherits Theta’s builder defaults).
Traits§
- Array
OfDoubles Input - Either ArrayOfDoubles sketch type can be fed into any of this module’s set operations — union, intersection, a-not-b, and Jaccard similarity. This trait is sealed — it cannot be implemented outside this crate — since the set-op shims only have concrete overloads for these two exact types.
Functions§
- array_
of_ doubles_ jaccard_ similarity - Estimates the Jaccard index (intersection-over-union) of two
ArrayOfDoubles sketches, each of which may independently be a
super::ArrayOfDoublesSketchor asuper::CompactArrayOfDoublesSketch.