public class ExpectationAggregator
extends Object
implements scala.Serializable
param: numFeatures The number of features. param: bcWeights The broadcast weights for each Gaussian distribution in the mixture. param: bcGaussians The broadcast array of Multivariate Gaussian (Normal) Distribution in the mixture. Note only upper triangular part of the covariance matrix of each distribution is stored as dense vector (column major) in order to reduce shuffled data size.
Constructor and Description |
---|
ExpectationAggregator(int numFeatures,
Broadcast<double[]> bcWeights,
Broadcast<scala.Tuple2<DenseVector,DenseVector>[]> bcGaussians) |
Modifier and Type | Method and Description |
---|---|
ExpectationAggregator |
add(Vector instance,
double weight)
Add a new training instance to this ExpectationAggregator, update the weights,
means and covariances for each distributions, and update the log likelihood.
|
long |
count() |
DenseVector[] |
covs() |
double |
logLikelihood() |
DenseVector[] |
means() |
ExpectationAggregator |
merge(ExpectationAggregator other)
Merge another ExpectationAggregator, update the weights, means and covariances
for each distributions, and update the log likelihood.
|
double[] |
weights() |
public ExpectationAggregator(int numFeatures, Broadcast<double[]> bcWeights, Broadcast<scala.Tuple2<DenseVector,DenseVector>[]> bcGaussians)
public ExpectationAggregator add(Vector instance, double weight)
instance
- The instance of data point to be added.weight
- The instance weight.public long count()
public DenseVector[] covs()
public double logLikelihood()
public DenseVector[] means()
public ExpectationAggregator merge(ExpectationAggregator other)
this
object will be modified.)
other
- The other ExpectationAggregator to be merged.public double[] weights()