Compare commits

...

2 Commits

3 changed files with 6 additions and 4 deletions

View File

@@ -15,6 +15,7 @@ Rust port of [TrueSkillThroughTime.py](https://github.com/glandfried/TrueSkillTh
- [x] Implement approx for Gaussian - [x] Implement approx for Gaussian
- [x] Add more tests from `TrueSkillThroughTime.jl` - [x] Add more tests from `TrueSkillThroughTime.jl`
- [ ] Add tests for `quality()` (Use [sublee/trueskill](https://github.com/sublee/trueskill/tree/master) as reference)
- [ ] Benchmark Batch::iteration() - [ ] Benchmark Batch::iteration()
- [ ] Time needs to be an enum so we can have multiple states (see `batch::compute_elapsed()`) - [ ] Time needs to be an enum so we can have multiple states (see `batch::compute_elapsed()`)
- [ ] Add examples (use same TrueSkillThroughTime.(py|jl)) - [ ] Add examples (use same TrueSkillThroughTime.(py|jl))

View File

@@ -23,12 +23,12 @@ impl<'a> Game<'a> {
weights: &'a [Vec<f64>], weights: &'a [Vec<f64>],
p_draw: f64, p_draw: f64,
) -> Self { ) -> Self {
assert!( debug_assert!(
(result.len() == teams.len()), (result.len() == teams.len()),
"result must have the same length as teams" "result must have the same length as teams"
); );
assert!( debug_assert!(
weights weights
.iter() .iter()
.zip(teams.iter()) .zip(teams.iter())
@@ -36,12 +36,12 @@ impl<'a> Game<'a> {
"weights must have the same dimensions as teams" "weights must have the same dimensions as teams"
); );
assert!( debug_assert!(
(0.0..1.0).contains(&p_draw), (0.0..1.0).contains(&p_draw),
"draw probability.must be >= 0.0 and < 1.0" "draw probability.must be >= 0.0 and < 1.0"
); );
assert!( debug_assert!(
p_draw > 0.0 || { p_draw > 0.0 || {
let mut r = result.to_vec(); let mut r = result.to_vec();
r.sort_unstable_by(|a, b| a.partial_cmp(b).unwrap()); r.sort_unstable_by(|a, b| a.partial_cmp(b).unwrap());

View File

@@ -256,6 +256,7 @@ pub(crate) fn evidence(d: &[DiffMessage], margin: &[f64], tie: &[bool], e: usize
} }
} }
/// Calculates the match quality of the given rating groups. A result is the draw probability in the association
pub fn quality(rating_groups: &[&[Gaussian]], beta: f64) -> f64 { pub fn quality(rating_groups: &[&[Gaussian]], beta: f64) -> f64 {
let flatten_ratings = rating_groups let flatten_ratings = rating_groups
.iter() .iter()