zhipeng93 commented on a change in pull request #28: URL: https://github.com/apache/flink-ml/pull/28#discussion_r757203755
########## File path: flink-ml-lib/src/main/java/org/apache/flink/ml/clustering/kmeans/KMeans.java ########## @@ -146,7 +145,7 @@ public IterationBodyResult process( DataStream<DenseVector> points = dataStreams.get(0); DataStream<Integer> terminationCriteria = - centroids.flatMap(new TerminateOnMaxIterationNum<>(maxIterationNum)); + centroids.map(x -> 0.).flatMap(new TerminationCriteria(maxIterationNum)); Review comment: During ML training, a common termination criteria is to terminate when number of iterations exceeds the specified max number of iterations, or the loss is smaller than a given tolerance (a tolerance is a `double`). If we want to allow termination on a data stream with arbitrary input type, we probably need to add a new class (i.e., `TerminateOnMaxIterationNum` here). IMO, maintaining two utility classes for termination may confuse the developers. What do you think? -- 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: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org