lindong28 commented on code in PR #195:
URL: https://github.com/apache/flink-ml/pull/195#discussion_r1059699156


##########
flink-ml-benchmark/src/main/java/org/apache/flink/ml/benchmark/datagenerator/clustering/KMeansModelDataGenerator.java:
##########
@@ -55,20 +61,36 @@ public Table[] getData(StreamTableEnvironment tEnv) {
         InputDataGenerator<?> vectorArrayGenerator = new 
DenseVectorArrayGenerator();
         ReadWriteUtils.updateExistingParams(vectorArrayGenerator, paramMap);
         vectorArrayGenerator.setNumValues(1);
+        vectorArrayGenerator.setColNames(new String[] {"centroids"});
+
+        Table centroidsTable = vectorArrayGenerator.getData(tEnv)[0];
 
-        Table vectorArrayTable = vectorArrayGenerator.getData(tEnv)[0];
-        DataStream<KMeansModelData> modelDataStream =
-                tEnv.toDataStream(vectorArrayTable, DenseVector[].class)
-                        .map(new GenerateKMeansModelDataFunction());
+        Table modelDataTable =
+                centroidsTable.select(
+                        $("centroids"),
+                        call(GenerateWeightsFunction.class, 
$("centroids")).as("weights"));

Review Comment:
   Can you explain why we need to make these changes and add names to those 
fields in the model data table?
   
   Would it be better to keep the API (e.g. table format) consistent with that 
used by the production code (i.e. KMeansModel and KMeans)? For example, 
`KMeans#fit()` converts data stream to the model data table using 
`tEnv.fromDataStream(finalModelData)`.
   
   Also, can we add a TODO/JIRA for creating nightly build to run all 
benchmarks nightly? We can use a small input number to verify that benchmark 
tools are broken.
   



##########
flink-ml-benchmark/src/main/java/org/apache/flink/ml/benchmark/datagenerator/param/HasNumDistinctValues.java:
##########
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.ml.benchmark.datagenerator.param;
+
+import org.apache.flink.ml.param.IntParam;
+import org.apache.flink.ml.param.Param;
+import org.apache.flink.ml.param.ParamValidators;
+import org.apache.flink.ml.param.WithParams;
+
+/** Interface for the benchmark num distinct values param. */
+public interface HasNumDistinctValues<T> extends WithParams<T> {

Review Comment:
   Should we update `RandomStringGenerator` to use this class to reduce code 
duplication?



-- 
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

Reply via email to