rszper commented on code in PR #27709:
URL: https://github.com/apache/beam/pull/27709#discussion_r1280954987


##########
website/www/site/content/en/documentation/transforms/python/elementwise/mltransform.md:
##########
@@ -0,0 +1,111 @@
+---
+title: "MLTransform"
+---
+<!--
+Licensed 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.
+-->
+
+# MLTransform for data processing
+
+{{< localstorage language language-py >}}
+
+
+<table>
+  <tr>
+    <td>
+      <a>
+      {{< button-pydoc path="apache_beam.ml.transforms" class="MLTransform" >}}
+      </a>
+   </td>
+  </tr>
+</table>
+
+
+`MLTransform` is used to apply common machine learning processing tasks on 
keyed data. Apache Beam provides ML data processing transformations which can 
be used with `MLTransform`. You can find the full list of available data
+processing transformations in the 
((GitHub)[https://github.com/apache/beam/blob/ab93fb1988051baac6c3b9dd1031f4d68bd9a149/sdks/python/apache_beam/ml/transforms/tft.py#L52])
 repository.
+
+
+To define a data processing transformation using `MLTransform`, you need to 
create instances of data processing transforms with `columns` as input 
paramter. The data in the specified `columns` will be transformed and outputted 
in the `beam.Row` object.
+
+Let's look at an example
+
+```
+scale_to_z_score_transform = ScaleToZScore(columns=['x', 'y'])
+with beam.Pipeline() as p:
+  (data | 
MLTransform(artifact_location).with_transform(scale_to_z_score_transform))
+```
+
+In this example, `MLTransform` receives `artifact_location`. This location is 
used to store artifacts generated by the `MLTransform`. We will talk about the 
`artifacts` later. The data processing transform can be passed using the 
`with_transform` method of `MLTransform` or transforms can be passed as list to 
the MLTransform.
+
+```
+MLTransform(transforms=transforms, artifact_location=artifact_location)
+```
+
+All the transforms passed to `MLTransform` are applied sequentially on the 
dataset. `MLTransform` expects a keyed data (Link to the supported inputs).
+
+
+## Example 1
+
+In the example we will create a pipeline that uses MLTransform to scale the 
data between 0 and 1.
+
+{{< highlight language="py" 
file="sdks/python/apache_beam/examples/snippets/transforms/elementwise/mltransform.py"
+  class="notebook-skip" >}}
+{{< code_sample 
"sdks/python/apache_beam/examples/snippets/transforms/elementwise/mltransform.py"
 mltransform_scale_to_0_1 >}}
+{{</ highlight >}}
+
+{{< paragraph class="notebook-skip" >}}
+Output:
+{{< /paragraph >}}
+{{< highlight class="notebook-skip" >}}
+{{< code_sample 
"sdks/python/apache_beam/examples/snippets/transforms/elementwise/mltransform_test.py"
 mltransform_scale_to_0_1 >}}
+{{< /highlight >}}
+
+
+The example takes a list of ints and converts them into the range of 0 to 1 
using the transform `ScaleTo01`.
+
+## Example 2

Review Comment:
   ```suggestion
   ### Example 2
   ```



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