pub struct GaussianMixture { /* private fields */ }Expand description
A mixture p(x) = Σ_k w_k N(x; μ_k, Σ_k) fitted by EM: the E-step computes each component’s
responsibility for each point, the M-step re-estimates weights, means and covariances from the
responsibility-weighted data, and the log-likelihood never decreases. Initialised from a k-means
run. reg_covar is added to every covariance diagonal so components cannot collapse onto single
points. Unlike k-means this is a soft clustering with elliptical clusters, and gives a
probability model: density, membership probabilities, and the BIC/AIC for choosing k.
Implementations§
Source§impl GaussianMixture
impl GaussianMixture
pub fn new(k: usize, covariance: CovarianceType, seed: u64) -> Self
pub fn with_limits(self, max_iterations: usize, tolerance: f64) -> Self
pub fn weights(&self) -> &[f64]
pub fn means(&self) -> &R2D
pub fn covariances(&self) -> &[R2D] ⓘ
Sourcepub fn mean_log_likelihood(&self) -> f64
pub fn mean_log_likelihood(&self) -> f64
The mean log-likelihood per sample on the training data.
pub fn iterations(&self) -> usize
Sourcepub fn bic(&self) -> f64
pub fn bic(&self) -> f64
Bayesian information criterion on the training data (lower is better).
Sourcepub fn predict_proba(&self, x: VR2D<'_>) -> Result<R2D, ErrorsJSL>
pub fn predict_proba(&self, x: VR2D<'_>) -> Result<R2D, ErrorsJSL>
Membership probabilities, (rows, components).
Trait Implementations§
Source§impl Clone for GaussianMixture
impl Clone for GaussianMixture
Source§impl Clusterer for GaussianMixture
impl Clusterer for GaussianMixture
Auto Trait Implementations§
impl Freeze for GaussianMixture
impl RefUnwindSafe for GaussianMixture
impl Send for GaussianMixture
impl Sync for GaussianMixture
impl Unpin for GaussianMixture
impl UnsafeUnpin for GaussianMixture
impl UnwindSafe for GaussianMixture
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more