(x: f64, mu: f64, sigma: f64)
| 427 | } |
| 428 | |
| 429 | fn normal_pdf(x: f64, mu: f64, sigma: f64) -> f64 { |
| 430 | let s = sigma.max(1e-8); |
| 431 | let z = (x - mu) / s; |
| 432 | (-0.5 * z * z).exp() / (s * (2.0 * std::f64::consts::PI).sqrt()) |
| 433 | } |
| 434 | |
| 435 | fn fit_two_normal_mixture_em( |
| 436 | samples: &[f64], |
no outgoing calls
no test coverage detected