zhipeng93 commented on code in PR #146:
URL: https://github.com/apache/flink-ml/pull/146#discussion_r957985954


##########
flink-ml-python/pyflink/ml/lib/feature/tests/test_binarizer.py:
##########
@@ -0,0 +1,105 @@
+################################################################################
+#  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.
+################################################################################
+import os
+
+from pyflink.common import Types
+
+from pyflink.ml.core.linalg import Vectors, DenseVectorTypeInfo, 
SparseVectorTypeInfo
+from pyflink.ml.lib.feature.binarizer import Binarizer
+from pyflink.ml.tests.test_utils import PyFlinkMLTestCase
+
+
+class BinarizerTest(PyFlinkMLTestCase):
+    def setUp(self):
+        super(BinarizerTest, self).setUp()
+        self.input_data_table = self.t_env.from_data_stream(
+            self.env.from_collection([
+                (1,
+                 Vectors.dense(1, 2),
+                 Vectors.sparse(17, [0, 3, 9], [1.0, 2.0, 7.0])),
+                (2,
+                 Vectors.dense(2, 1),
+                 Vectors.sparse(17, [0, 2, 14], [5.0, 4.0, 1.0])),
+                (3,
+                 Vectors.dense(5, 18),
+                 Vectors.sparse(17, [0, 11, 12], [2.0, 4.0, 4.0]))
+            ],
+                type_info=Types.ROW_NAMED(
+                    ['f0', 'f1', 'f2'],
+                    [Types.INT(), DenseVectorTypeInfo(), 
SparseVectorTypeInfo()])))
+
+        self.expected_output_data_1 = Vectors.dense(0.0, 1.0)

Review Comment:
   `expected_output_data` can be a list of vector.



##########
flink-ml-python/pyflink/ml/lib/feature/tests/test_binarizer.py:
##########
@@ -0,0 +1,105 @@
+################################################################################
+#  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.
+################################################################################
+import os
+
+from pyflink.common import Types
+
+from pyflink.ml.core.linalg import Vectors, DenseVectorTypeInfo, 
SparseVectorTypeInfo
+from pyflink.ml.lib.feature.binarizer import Binarizer
+from pyflink.ml.tests.test_utils import PyFlinkMLTestCase
+
+
+class BinarizerTest(PyFlinkMLTestCase):
+    def setUp(self):
+        super(BinarizerTest, self).setUp()
+        self.input_data_table = self.t_env.from_data_stream(
+            self.env.from_collection([
+                (1,
+                 Vectors.dense(1, 2),
+                 Vectors.sparse(17, [0, 3, 9], [1.0, 2.0, 7.0])),
+                (2,
+                 Vectors.dense(2, 1),
+                 Vectors.sparse(17, [0, 2, 14], [5.0, 4.0, 1.0])),
+                (3,
+                 Vectors.dense(5, 18),
+                 Vectors.sparse(17, [0, 11, 12], [2.0, 4.0, 4.0]))
+            ],
+                type_info=Types.ROW_NAMED(
+                    ['f0', 'f1', 'f2'],
+                    [Types.INT(), DenseVectorTypeInfo(), 
SparseVectorTypeInfo()])))
+
+        self.expected_output_data_1 = Vectors.dense(0.0, 1.0)

Review Comment:
   nit: `expected_output_data` could be a list of vector.



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

Reply via email to