Skip to content

Commit 4e7978f

Browse files
committed
cargo fmt
1 parent 0717563 commit 4e7978f

File tree

2 files changed

+9
-16
lines changed

2 files changed

+9
-16
lines changed

src/dist/betaprime.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,9 @@ impl ConjugatePrior<usize, StickBreakingDiscrete> for BetaPrime {
424424
type MCache = f64;
425425
type PpCache = f64;
426426

427-
fn empty_stat(&self) -> <StickBreakingDiscrete as HasSuffStat<usize>>::Stat {
427+
fn empty_stat(
428+
&self,
429+
) -> <StickBreakingDiscrete as HasSuffStat<usize>>::Stat {
428430
StickBreakingDiscreteSuffStat::new()
429431
}
430432

@@ -605,18 +607,17 @@ mod tests {
605607
}
606608
}
607609

608-
609610
#[test]
610611
fn test_posterior() {
611612
let prior = BetaPrime::new(2.0, 1.0).unwrap();
612-
let data = vec![0, 1, 1, 2, 2, 2]; // This gives counts [2, 2, 3]
613+
let data = vec![0, 1, 1, 2, 2, 2]; // This gives counts [2, 2, 3]
613614
let posterior = prior.posterior(&DataOrSuffStat::Data(&data));
614615
// Our observation is [C₀, C₁, C₂] = [1, 2, 3]
615-
// So
616+
// So
616617
// ∑ j Cⱼ = 0 * 1 + 1 * 2 + 2 * 3 = 8
617-
// and
618+
// and
618619
// ∑ Cⱼ = 1 + 2 + 3 = 6
619-
//
620+
//
620621
// So the posterior is BetaPrime(2 + 8, 1 + 6) = BetaPrime(10, 7)
621622
//
622623
// See See https://github.com/cscherrer/stick-breaking for details

src/dist/categorical.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -339,11 +339,7 @@ mod tests {
339339
// weights the def do not sum to 1
340340
let weights: Vec<f64> = vec![2.0, 1.0, 2.0, 3.0, 1.0];
341341
let cat = Categorical::new(&weights).unwrap();
342-
assert::close(
343-
cat.ln_weights.iter().copied().logsumexp(),
344-
0.0,
345-
TOL,
346-
);
342+
assert::close(cat.ln_weights.iter().copied().logsumexp(), 0.0, TOL);
347343
}
348344

349345
#[test]
@@ -354,11 +350,7 @@ mod tests {
354350
cat.ln_weights
355351
.iter()
356352
.for_each(|&ln_w| assert::close(ln_w, ln_weight, TOL));
357-
assert::close(
358-
cat.ln_weights.iter().copied().logsumexp(),
359-
0.0,
360-
TOL,
361-
);
353+
assert::close(cat.ln_weights.iter().copied().logsumexp(), 0.0, TOL);
362354
}
363355

364356
#[test]

0 commit comments

Comments
 (0)