use of com.alibaba.alink.operator.batch.clustering.GmmTrainBatchOp in project Alink by alibaba.
the class GaussianMixtureTest method testLazyPrintClusterSummaries.
@Test
public void testLazyPrintClusterSummaries() throws Exception {
VectorAssemblerBatchOp op = new VectorAssemblerBatchOp().setSelectedCols(Iris.getFeatureColNames()).setOutputCol("x").linkFrom(Iris.getBatchData());
GmmTrainBatchOp gmm = new GmmTrainBatchOp().setVectorCol("x").setK(2).setEpsilon(0.).linkFrom(op);
GmmPredictBatchOp predict = new GmmPredictBatchOp().setVectorCol("x").setPredictionCol("pred").linkFrom(gmm, op);
ClusterMetrics eval = new EvalClusterBatchOp().setVectorCol("x").setLabelCol(Iris.getLabelColName()).setPredictionCol("pred").linkFrom(predict).collectMetrics();
Assert.assertEquals(eval.getDb(), 1.15, 0.01);
Assert.assertEquals(eval.getAri(), 0.35, 0.01);
}
Aggregations