EMGMM

object EMGMM

EM-GMM implementation. Inspired by the work of Maƫl Fabien: https://github.com/maelfabien/EM_GMM_HMM

class Object
trait Matchable
class Any

Value members

Concrete methods

def compute_log_likelihood(x: Array[Array[Double]], means: Array[Array[Double]], covariances: Array[Array[Array[Double]]], weights: Array[Double]): Array[Array[Double]]

Compute the log likelihood (used for e step).

Compute the log likelihood (used for e step).

Value Params
covariances

covariances of the components (clusters)

means

means of the components (clusters)

weights

weights of the components (clusters)

x

data points

def cov(x: Array[Array[Double]], columns: Int): Array[Array[Double]]

Estimate a covariance matrix, given data.

Estimate a covariance matrix, given data.

Value Params
columns

number of columns of the points

x

data points

def dilate(gmm: GMM, f: Double): GMM
def dot(A: Array[Array[Double]], B: Array[Array[Double]]): Array[Array[Double]]

2d matrix dot product.

2d matrix dot product.

Value Params
A

matrix A

B

matrix B

def eStep(x: Array[Array[Double]], means: Array[Array[Double]], covariances: Array[Array[Array[Double]]], weights: Array[Double]): (Double, Array[Array[Double]])

E-step: compute responsibilities, update resp matrix so that resp[j, k] is the responsibility of cluster k for data point j, to compute likelihood of seeing data point j given cluster k.

E-step: compute responsibilities, update resp matrix so that resp[j, k] is the responsibility of cluster k for data point j, to compute likelihood of seeing data point j given cluster k.

Value Params
covariances

covariances of the components (clusters)

means

means of the components (clusters)

weights

weights of the components (clusters)

x

data points

@tailrec
def fit(x: Array[Array[Double]], means: Array[Array[Double]], covariances: Array[Array[Array[Double]]], weights: Array[Double], components: Int, iterations: Int, tolerance: Double, logLikelihood: Double, trace: Seq[Double]): (GMM, Seq[Double])
def initializeAndFit(components: Int, iterations: Int, tolerance: Double, x: Array[Array[Double]], columns: Int, random: Random): (GMM, Seq[Double])

Full covariance Gaussian Mixture Model, trained using Expectation Maximization.

Full covariance Gaussian Mixture Model, trained using Expectation Maximization.

Value Params
columns

number of data columns

x

data points

def mStep(X: Array[Array[Double]], resp: Array[Array[Double]], components: Int): (Array[Double], Array[Array[Double]], Array[Array[Array[Double]]])

M-step, update parameters.

M-step, update parameters.

Value Params
X

data points

def toDistribution(gmm: GMM, random: Random): MixtureMultivariateNormalDistribution