ExpectationMaximization is an unsupervised machine learning model that estimates the probability distribution of a dataset and assigns each data point to a cluster based on its most likely probability.
Contains a table of matrices.
ModelParameters[1]: piMatrix. The rows represent the clusters.
ModelParameters[2]: meanMatrix. The rows represent the clusters. The columns represent the features.
ModelParameters[3]: varianceMatrix. The rows represent the clusters. The columns represent the features.
Create new model object. If any of the arguments are nil, default argument values for that argument will be used.
ExpectationMaximization.new(maximumNumberOfIterations: integer, numberOfClusters: integer, epsilon: number): ModelObject
maximumNumberOfIterations: The maximum number of iterations.
numberOfClusters: Number of clusters for model to train and predict on. When using default or set to math.huge(), it will find the best number of clusters using Bayesian information criterion.
epsilon: The value to ensure that Gaussian calculation doesn’t reach infinity.
Set model’s parameters. When any of the arguments are nil, previous argument values for that argument will be used.
ExpectationMaximization:setParameters(maximumNumberOfIterations: integer, numberOfClusters: integer, epsilon: number)
maximumNumberOfIterations: The maximum number of iterations.
numberOfClusters: Number of clusters for model to train and predict on. When using default or set to math.huge(), it will find the best number of clusters using Bayesian information criterion.
epsilon: The value to ensure that Gaussian calculation doesn’t reach infinity.
Train the model.
ExpectationMaximization:train(featureMatrix: Matrix)
Predict which cluster does it belong to for a given data.
ExpectationMaximization:predict(featureMatrix: Matrix): integer, number
clusterNumber: The cluster which the data belongs to.
highestProbabilityVector: The probability (n x 1) matrix of the datapoint belongs to that particular cluster.