dianfu commented on code in PR #101:
URL: https://github.com/apache/flink-ml/pull/101#discussion_r877853648
##########
docs/content/docs/operators/classification/naivebayes.md:
##########
@@ -95,6 +98,69 @@ Table outputTable = model.transform(predictTable)[0];
outputTable.execute().print();
```
+{{< /tab>}}
+
+
+{{< tab "Python">}}
+```python
+from pyflink.common import Types
+from pyflink.table import StreamTableEnvironment
+
+from pyflink.ml.core.linalg import Vectors, DenseVectorTypeInfo
+from pyflink.ml.lib.classification.naivebayes import NaiveBayes
+
+# create a new StreamExecutionEnvironment
+env = StreamExecutionEnvironment.get_execution_environment()
+
+# load flink ml jar
+env.add_jars("file:///{path}/statefun-flink-core-3.1.0.jar;file:///{path}/flink-ml-uber-{version}.jar")
Review Comment:
ditto
##########
docs/content/docs/operators/classification/knn.md:
##########
@@ -113,4 +116,75 @@ Table output = knnModel.transform(predictData)[0];
output.execute().print();
```
+{{< /tab>}}
+
+{{< tab "Python">}}
+```python
+from pyflink.common import Types
+from pyflink.table import StreamTableEnvironment
+
+from pyflink.ml.core.linalg import Vectors, DenseVectorTypeInfo
+from pyflink.ml.lib.classification.knn import KNN
+
+# create a new StreamExecutionEnvironment
+env = StreamExecutionEnvironment.get_execution_environment()
+
+# load flink ml jar
+env.add_jars("file:///{path}/statefun-flink-core-3.1.0.jar;file:///{path}/flink-ml-uber-{version}.jar")
Review Comment:
```suggestion
env.add_jars("file:///{path}/statefun-flink-core-3.1.0.jar",
"file:///{path}/flink-ml-uber-{version}.jar")
```
##########
docs/content/docs/operators/feature/onehotencoder.md:
##########
@@ -74,6 +77,54 @@ Table outputTable = model.transform(predictTable)[0];
outputTable.execute().print();
```
+{{< /tab>}}
+
+{{< tab "Python">}}
+```python
+from pyflink.common import Types, Row
+from pyflink.table import StreamTableEnvironment, Table, DataTypes
+
+from pyflink.ml.lib.feature.onehotencoder import OneHotEncoder,
OneHotEncoderModel
+
+# create a new StreamExecutionEnvironment
+env = StreamExecutionEnvironment.get_execution_environment()
+
+# load flink ml jar
+env.add_jars("file:///{path}/statefun-flink-core-3.1.0.jar;file:///{path}/flink-ml-uber-{version}.jar")
Review Comment:
ditto
##########
docs/content/docs/operators/clustering/kmeans.md:
##########
@@ -96,3 +99,57 @@ for (CloseableIterator<Row> it = output.execute().collect();
it.hasNext(); ) {
System.out.println("Vector: " + vector + "\tCluster ID: " + clusterId);
}
```
+{{< /tab>}}
+
+{{< tab "Python">}}
+```python
+from pyflink.common import Types
+from pyflink.table import StreamTableEnvironment
+
+from pyflink.ml.core.linalg import Vectors, DenseVectorTypeInfo
+from pyflink.ml.lib.clustering.kmeans import KMeans
+
+# create a new StreamExecutionEnvironment
+env = StreamExecutionEnvironment.get_execution_environment()
+
+# load flink ml jar
+env.add_jars("file:///{path}/statefun-flink-core-3.1.0.jar;file:///{path}/flink-ml-uber-{version}.jar")
Review Comment:
ditto
##########
docs/content/docs/operators/classification/logisticregression.md:
##########
@@ -105,4 +107,64 @@ Table output = model.transform(binomialDataTable)[0];
output.execute().print();
```
-
+{{< /tab>}}
+
+{{< tab "Python">}}
+```python
+from pyflink.common import Types
+from pyflink.table import StreamTableEnvironment
+
+from pyflink.ml.core.linalg import Vectors, DenseVectorTypeInfo
+from pyflink.ml.lib.classification.logisticregression import LogisticRegression
+
+# create a new StreamExecutionEnvironment
+env = StreamExecutionEnvironment.get_execution_environment()
+
+# load flink ml jar
+env.add_jars("file:///{path}/statefun-flink-core-3.1.0.jar;file:///{path}/flink-ml-uber-{version}.jar")
Review Comment:
ditto
--
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]