ASAP: Active Sampling for Pairwise Comparisons
A Rust implementation of the ASAP algorithm for active sampling in pairwise comparison preference aggregation. The algorithm offers high accuracy for inferring scores while minimizing the number of comparisons needed.
Based on the paper: "Active Sampling for Pairwise Comparisons via Approximate Message Passing and Information Gain Maximization" by A. Mikhailiuk, C. Wilmot, M. Perez-Ortiz, D. Yue and R. K. Mantiuk (2020).
Features
- Accurate score inference from pairwise comparisons
- Suggestion of most informative comparisons to perform next
- Confidence estimation for the current ranking
- Support for both accurate and approximate algorithm versions
Usage
use ;
// Create a new model with items
let items = vec!;
let mut model = new;
// Add pairwise comparisons
model.add_comparison.unwrap;
model.add_comparison.unwrap;
// Get inferred scores
let scores = model.get_scores.unwrap;
println!;
// Get ordered ranking
let ranking = model.get_ordering.unwrap;
println!;
// Get suggestions for next comparisons
let suggestions = model.suggest_comparisons.unwrap;
println!;
// Check if we have enough confidence in the ranking
let is_confident = model.is_sufficiently_confident.unwrap;
println!;
Implementation Details
This implementation provides both the accurate and approximate versions of the ASAP algorithm:
- Accurate Version: Uses full posterior updates for maximum accuracy
- Approximate Version: Uses online posterior updates for reduced computation cost
The accurate version is used by default, but the approximate version can be enabled for larger datasets where performance is a concern.
Examples
The repository includes an example binary that demonstrates:
- Basic usage of the ASAP algorithm
- Score recovery from pairwise comparisons with noise
Run the example with:
cargo run --bin example
Testing
The implementation includes both unit tests and integration tests:
- Unit tests verify the correctness of individual components
- Integration tests validate the algorithm's ability to recover scores from pairwise comparisons
Run the tests with:
cargo test
License
AGPL-3.0