MeanWithClusterProbAggregator implements Serializable { MeanWithClusterProbAggregator plus(MeanWithClusterProbAggregator other) { return new MeanWithClusterProbAggregator( weightedXsSum.plus(other.weightedXsSum), pcxiSum + other.pcxiSum, rowCount + other.rowCount ); } MeanWithClusterProbAggregator();   MeanWithClusterProbAggregator(Vector weightedXsSum, double pcxiSum, int rowCount); Vector mean(); double clusterProb(); static AggregatedStats aggreateStats(Dataset<EmptyContext, GmmPartitionData> dataset, int countOfComponents);  }
@Test public void testPlus() { MeanWithClusterProbAggregator res = aggregator1.plus(aggregator2); assertEquals(0.7, res.clusterProb(), 1e-4); assertArrayEquals(new double[] {0.580, 0.491}, res.mean().asArray(), 1e-2); }