yunfengzhou-hub commented on a change in pull request #70:
URL: https://github.com/apache/flink-ml/pull/70#discussion_r829798468
##########
File path:
flink-ml-lib/src/test/java/org/apache/flink/ml/clustering/KMeansTest.java
##########
@@ -207,25 +211,21 @@ public void testSaveLoadAndPredict() throws Exception {
KMeansModel loadedModel =
StageTestUtils.saveAndReload(env, model,
tempFolder.newFolder().getAbsolutePath());
Table output = loadedModel.transform(dataTable)[0];
- assertEquals(
- Collections.singletonList("centroids"),
-
loadedModel.getModelData()[0].getResolvedSchema().getColumnNames());
assertEquals(
Arrays.asList("features", "prediction"),
output.getResolvedSchema().getColumnNames());
+ List<Row> results = IteratorUtils.toList(output.execute().collect());
List<Set<DenseVector>> actualGroups =
- executeAndCollect(output, kmeans.getFeaturesCol(),
kmeans.getPredictionCol());
+ groupFeaturesByPrediction(
+ results, kmeans.getFeaturesCol(),
kmeans.getPredictionCol());
assertTrue(CollectionUtils.isEqualCollection(expectedGroups,
actualGroups));
}
@Test
public void testGetModelData() throws Exception {
KMeans kmeans = new KMeans().setMaxIter(2).setK(2);
KMeansModel model = kmeans.fit(dataTable);
- assertEquals(
- Collections.singletonList("centroids"),
Review comment:
I had once changed the design of `KMeansModelData` to make it contain
more than centroids (adding weights field), and this removal is the result of
that change. Now I have recovered `KMeansModelData`'s structure, but forgot to
add back this check. I'll fix it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]