What is the definition of flakiness?
tyilo opened this issue · comments
The documentation doesn't seem to mention what the range of flakiness
should be for the Searcher::report
method.
The following code crashes:
use robust_binary_search::Searcher;
fn main() {
let mut searcher = Searcher::new(10);
searcher.report(5, true, 0.0);
searcher.report(4, false, 0.0);
let best_index = searcher.best_index();
dbg!(best_index);
let likehood = searcher.likelihood(best_index);
dbg!(likehood);
let next_index = searcher.next_index();
dbg!(next_index);
}
Output:
[src/main.rs:10:5] best_index = 10
[src/main.rs:12:5] likehood = NaN
thread 'main' panicked at /home/tyilo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/robust-binary-search-0.1.1/src/lib.rs:127:5:
assertion failed: best_percentile > f64::NEG_INFINITY
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
flakiness
should be between 0 and 1, excluding both 0 and 1. I'll update the docs. I'd recommend using AutoSearcher
if you don't know what the value should be.
Thanks. I basically want to binary search, where some values are unknown and others are completely known, that is flakiness 0 and 1.
Maybe there is a better library for this, but I tried to make this work :)