Skip to content
This repository was archived by the owner on Jul 16, 2021. It is now read-only.

GMM CovOption redesign #153

@andrewcsmith

Description

@andrewcsmith

After looking at the sklearn code and seeing the huge number of possible places that CovOption can come into play, I'd like to propose a redesign of the way we handle various CovOption values.

The basic idea is that this will let us expand the types of CovOption values that we have without changing the match statements, making our API more resilient and allowing other library authors to pass their own values without necessarily needing to have their changes approved and incorporated upstream.

Trait

Create a trait that encompasses the few methods that involve CovOption. This should be something like:

pub trait CovOption {
    /// Initializes the values for GMM, replaces gmm.rs:81
    fn initial_values(inputs: &Matrix<f64>) -> Matrix<f64>;
    /// Compute the covariance, replaces gmm.rs:334
    fn compute_cov(diff: Matrix<f64>, weight: f64);
}

Structs

Create a struct for each variant of our current enum. The code for this should be pretty obvious so I won't repeat it here.

GaussianMixtureModel

Similar to now, it will take a struct S where S: CovOption.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions