Skip to content

Commit 51ded5d

Browse files
committed
Better documentation for histogram bounds
Especially the inclusive end for the last range
1 parent adbe99f commit 51ded5d

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

core/src/annostorage/inmemory.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,12 @@ pub struct AnnoStorageImpl<T: Ord + Hash + Default> {
3232
anno_key_sizes: BTreeMap<AnnoKey, usize>,
3333
anno_keys: SymbolTable<AnnoKey>,
3434
anno_values: SymbolTable<String>,
35-
36-
/// additional statistical information
35+
/// Sampled histograms for each annotation key .
36+
/// Each histogram bound defines a range of values where we estimate that they have the same number of occurences.
37+
///
38+
/// If h_i the the histogram bound value at index i, the first range is defined is as [h_0, h_1), the second range from [h_1, h_2) and so on.
39+
/// Thus each element marks the inclusive start of a range and an exclusive end.
40+
/// **The last range \[h_n-1, h_n\] has an inclusive upper bound instead of an exclusive one!**
3741
histogram_bounds: BTreeMap<usize, Vec<String>>,
3842
largest_item: Option<T>,
3943
total_number_of_annos: usize,

core/src/annostorage/ondisk.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,12 @@ where
4848

4949
anno_key_sizes: BTreeMap<AnnoKey, usize>,
5050

51-
/// additional statistical information
51+
/// Sampled histograms for each annotation key .
52+
/// Each histogram bound defines a range of values where we estimate that they have the same number of occurences.
53+
///
54+
/// If h_i the the histogram bound value at index i, the first range is defined is as [h_0, h_1), the second range from [h_1, h_2) and so on.
55+
/// Thus each element marks the inclusive start of a range and an exclusive end.
56+
/// **The last range \[h_n-1, h_n\] has an inclusive upper bound instead of an exclusive one!**
5257
histogram_bounds: BTreeMap<AnnoKey, Vec<String>>,
5358
largest_item: Option<T>,
5459

0 commit comments

Comments
 (0)