Fanoid commented on code in PR #191:
URL: https://github.com/apache/flink-ml/pull/191#discussion_r1059261237


##########
flink-ml-python/pyflink/ml/lib/feature/lsh.py:
##########
@@ -0,0 +1,191 @@
+################################################################################
+#  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 typing
+from abc import ABC
+from pyflink.java_gateway import get_gateway
+from pyflink.table import Table
+from pyflink.util.java_utils import to_jarray
+
+from pyflink.ml.core.linalg import Vector, DenseVector, SparseVector
+from pyflink.ml.core.param import Param, IntParam, ParamValidators
+from pyflink.ml.core.wrapper import JavaWithParams
+from pyflink.ml.lib.feature.common import JavaFeatureEstimator, 
JavaFeatureModel
+from pyflink.ml.lib.param import HasInputCol, HasOutputCol, HasSeed
+
+
+class _LSHParams(
+    JavaWithParams,
+    HasInputCol,
+    HasOutputCol,
+    HasSeed
+):
+    """
+    Params for :class:`LSH`
+    """
+
+    NUM_HASH_TABLES: Param[int] = IntParam(
+        "num_hash_tables", "Number of hash tables.", 1, 
ParamValidators.gt_eq(1)
+    )
+
+    NUM_HASH_FUNCTIONS_PER_TABLE: Param[int] = IntParam(
+        "num_hash_functions_per_table",
+        "Number of hash functions per table.",
+        1,
+        ParamValidators.gt_eq(1.))
+
+    def __init__(self, java_params):
+        super(_LSHParams, self).__init__(java_params)
+
+    def set_num_hash_tables(self, value: int):
+        return typing.cast(_LSHParams, self.set(self.NUM_HASH_TABLES, value))
+
+    def get_num_hash_tables(self):
+        return self.get(self.NUM_HASH_TABLES)
+
+    @property
+    def num_hash_tables(self):
+        return self.get_num_hash_tables()
+
+    def set_num_hash_functions_per_table(self, value: int):
+        return typing.cast(_LSHParams, 
self.set(self.NUM_HASH_FUNCTIONS_PER_TABLE, value))
+
+    def get_num_hash_functions_per_table(self):
+        return self.get(self.NUM_HASH_FUNCTIONS_PER_TABLE)
+
+    @property
+    def num_hash_functions_per_table(self):
+        return self.get_num_hash_functions_per_table()
+
+
+class _LSHModelParams(JavaWithParams,
+                      HasInputCol,
+                      HasOutputCol):
+    ...

Review Comment:
   Thanks for your reminder. I've added the constructor.



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