pub struct EMAlgorithm {
pub max_iter: usize,
pub tol: Float,
pub reg_covar: Float,
pub covariance_type: CovarianceType,
pub init_params: WeightInit,
pub random_state: Option<u64>,
}Expand description
Core EM Algorithm implementation with SIMD acceleration
Fields§
§max_iter: usizeMaximum number of EM iterations
tol: FloatConvergence tolerance for log-likelihood change
reg_covar: FloatRegularization added to covariance diagonal for numerical stability
covariance_type: CovarianceTypeType of covariance matrix to use
init_params: WeightInitInitialization strategy for component weights
random_state: Option<u64>Seed for reproducible random initialization
Implementations§
Source§impl EMAlgorithm
impl EMAlgorithm
Sourcepub fn new(max_iter: usize, tol: Float, reg_covar: Float) -> Self
pub fn new(max_iter: usize, tol: Float, reg_covar: Float) -> Self
Create a new EM algorithm instance
Sourcepub fn covariance_type(self, covariance_type: CovarianceType) -> Self
pub fn covariance_type(self, covariance_type: CovarianceType) -> Self
Set covariance type
Sourcepub fn init_params(self, init_params: WeightInit) -> Self
pub fn init_params(self, init_params: WeightInit) -> Self
Set initialization method
Sourcepub fn random_state(self, seed: u64) -> Self
pub fn random_state(self, seed: u64) -> Self
Set random state
Sourcepub fn fit(
&self,
x: &ArrayView2<'_, Float>,
n_components: usize,
) -> Result<EMResult>
pub fn fit( &self, x: &ArrayView2<'_, Float>, n_components: usize, ) -> Result<EMResult>
Run the complete EM algorithm
Sourcepub fn initialize_parameters(
&self,
x: &ArrayView2<'_, Float>,
n_components: usize,
) -> Result<(Array1<Float>, Array2<Float>, Vec<Array2<Float>>)>
pub fn initialize_parameters( &self, x: &ArrayView2<'_, Float>, n_components: usize, ) -> Result<(Array1<Float>, Array2<Float>, Vec<Array2<Float>>)>
Initialize GMM parameters with SIMD-accelerated operations
Sourcepub fn e_step_simd(
&self,
x: &ArrayView2<'_, Float>,
weights: &Array1<Float>,
means: &Array2<Float>,
covariances: &[Array2<Float>],
) -> Result<Array2<Float>>
pub fn e_step_simd( &self, x: &ArrayView2<'_, Float>, weights: &Array1<Float>, means: &Array2<Float>, covariances: &[Array2<Float>], ) -> Result<Array2<Float>>
E-step: Compute responsibilities using SIMD acceleration
Auto Trait Implementations§
impl Freeze for EMAlgorithm
impl RefUnwindSafe for EMAlgorithm
impl Send for EMAlgorithm
impl Sync for EMAlgorithm
impl Unpin for EMAlgorithm
impl UnsafeUnpin for EMAlgorithm
impl UnwindSafe for EMAlgorithm
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.