You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by "AnandInguva (via GitHub)" <gi...@apache.org> on 2023/07/27 13:18:06 UTC

[GitHub] [beam] AnandInguva opened a new pull request, #27709: [WIP] MLTransform transform catalog

AnandInguva opened a new pull request, #27709:
URL: https://github.com/apache/beam/pull/27709

   **Please** add a meaningful description for your change here
   
   ------------------------
   
   Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
   
    - [ ] Mention the appropriate issue in your description (for example: `addresses #123`), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, comment `fixes #<ISSUE NUMBER>` instead.
    - [ ] Update `CHANGES.md` with noteworthy changes.
    - [ ] If this contribution is large, please file an Apache [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
   
   See the [Contributor Guide](https://beam.apache.org/contribute) for more tips on [how to make review process smoother](https://beam.apache.org/contribute/get-started-contributing/#make-the-reviewers-job-easier).
   
   To check the build health, please visit [https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md](https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md)
   
   GitHub Actions Tests Status (on master branch)
   ------------------------------------------------------------------------------------------------
   [![Build python source distribution and wheels](https://github.com/apache/beam/workflows/Build%20python%20source%20distribution%20and%20wheels/badge.svg?branch=master&event=schedule)](https://github.com/apache/beam/actions?query=workflow%3A%22Build+python+source+distribution+and+wheels%22+branch%3Amaster+event%3Aschedule)
   [![Python tests](https://github.com/apache/beam/workflows/Python%20tests/badge.svg?branch=master&event=schedule)](https://github.com/apache/beam/actions?query=workflow%3A%22Python+Tests%22+branch%3Amaster+event%3Aschedule)
   [![Java tests](https://github.com/apache/beam/workflows/Java%20Tests/badge.svg?branch=master&event=schedule)](https://github.com/apache/beam/actions?query=workflow%3A%22Java+Tests%22+branch%3Amaster+event%3Aschedule)
   [![Go tests](https://github.com/apache/beam/workflows/Go%20tests/badge.svg?branch=master&event=schedule)](https://github.com/apache/beam/actions?query=workflow%3A%22Go+tests%22+branch%3Amaster+event%3Aschedule)
   
   See [CI.md](https://github.com/apache/beam/blob/master/CI.md) for more information about GitHub Actions CI or the [workflows README](https://github.com/apache/beam/blob/master/.github/workflows/README.md) to see a list of phrases to trigger workflows.
   


-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] github-actions[bot] commented on pull request #27709: MLTransform transform catalog snippets

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #27709:
URL: https://github.com/apache/beam/pull/27709#issuecomment-1660512960

   Checks are failing. Will not request review until checks are succeeding. If you'd like to override that behavior, comment `assign set of reviewers`


-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] rszper commented on a diff in pull request #27709: MLTransform transform catalog snippets

Posted by "rszper (via GitHub)" <gi...@apache.org>.
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] AnandInguva commented on pull request #27709: MLTransform transform catalog snippets

Posted by "AnandInguva (via GitHub)" <gi...@apache.org>.
AnandInguva commented on PR #27709:
URL: https://github.com/apache/beam/pull/27709#issuecomment-1686644461

   PTAL @rszper


-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] rszper commented on a diff in pull request #27709: MLTransform transform catalog snippets

Posted by "rszper (via GitHub)" <gi...@apache.org>.
rszper commented on code in PR #27709:
URL: https://github.com/apache/beam/pull/27709#discussion_r1300421093


##########
website/www/site/content/en/documentation/transforms/python/elementwise/mltransform.md:
##########
@@ -0,0 +1,120 @@
+---
+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>
+
+
+Use `MLTransform` to apply common machine learning (ML) processing tasks on keyed data. Apache Beam provides ML data processing transformations that you can use with `MLTransform`. For the full list of available data
+processing transformations, see the [tft.py file](https://github.com/apache/beam/blob/ab93fb1988051baac6c3b9dd1031f4d68bd9a149/sdks/python/apache_beam/ml/transforms/tft.py#L52) in GitHub.
+
+
+To define a data processing transformation by using `MLTransform`, create instances of data processing transforms with `columns` as input parameters. The data in the specified `columns` is transformed and outputted to the `beam.Row` object.
+
+The following example demonstrates how to use `MLTransform` to normalize your data between 0 and 1 by using the minimum and maximum values from your entire dataset. `MLTransform` uses the `ScaleTo01` transformation.
+
+
+```
+scale_to_z_score_transform = ScaleToZScore(columns=['x', 'y'])
+with beam.Pipeline() as p:
+  (data | MLTransform(write_artifact_location=artifact_location).with_transform(scale_to_z_score_transform))
+```
+
+In this example, `MLTransform` receives a value for `write_artifact_location`. `MLTransform` then uses this location value to write artifacts generated by the transform. To pass the data processing transform, you can use either the with_transform method of `MLTransform` or a list.
+
+```
+MLTransform(transforms=transforms, write_artifact_location=write_artifact_location)
+```
+
+The transforms passed to `MLTransform` are applied sequentially on the dataset. `MLTransform` expects a dictionary and return a transformed Row objecst with numpy arrays.

Review Comment:
   ```suggestion
   The transforms passed to `MLTransform` are applied sequentially on the dataset. `MLTransform` expects a dictionary and returns a transformed row object with NumPy arrays.
   ```



##########
website/www/site/content/en/documentation/transforms/python/elementwise/mltransform.md:
##########
@@ -0,0 +1,120 @@
+---
+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>
+
+
+Use `MLTransform` to apply common machine learning (ML) processing tasks on keyed data. Apache Beam provides ML data processing transformations that you can use with `MLTransform`. For the full list of available data
+processing transformations, see the [tft.py file](https://github.com/apache/beam/blob/ab93fb1988051baac6c3b9dd1031f4d68bd9a149/sdks/python/apache_beam/ml/transforms/tft.py#L52) in GitHub.
+
+
+To define a data processing transformation by using `MLTransform`, create instances of data processing transforms with `columns` as input parameters. The data in the specified `columns` is transformed and outputted to the `beam.Row` object.
+
+The following example demonstrates how to use `MLTransform` to normalize your data between 0 and 1 by using the minimum and maximum values from your entire dataset. `MLTransform` uses the `ScaleTo01` transformation.
+
+
+```
+scale_to_z_score_transform = ScaleToZScore(columns=['x', 'y'])
+with beam.Pipeline() as p:
+  (data | MLTransform(write_artifact_location=artifact_location).with_transform(scale_to_z_score_transform))
+```
+
+In this example, `MLTransform` receives a value for `write_artifact_location`. `MLTransform` then uses this location value to write artifacts generated by the transform. To pass the data processing transform, you can use either the with_transform method of `MLTransform` or a list.

Review Comment:
   ```suggestion
   In this example, `MLTransform` receives a value for `write_artifact_location`. `MLTransform` then uses this location value to write artifacts generated by the transform. To pass the data processing transform, you can use either the `with_transform` method of `MLTransform` or a list.
   ```



##########
website/www/site/content/en/documentation/transforms/python/elementwise/mltransform.md:
##########
@@ -0,0 +1,120 @@
+---
+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>
+
+
+Use `MLTransform` to apply common machine learning (ML) processing tasks on keyed data. Apache Beam provides ML data processing transformations that you can use with `MLTransform`. For the full list of available data
+processing transformations, see the [tft.py file](https://github.com/apache/beam/blob/ab93fb1988051baac6c3b9dd1031f4d68bd9a149/sdks/python/apache_beam/ml/transforms/tft.py#L52) in GitHub.
+
+
+To define a data processing transformation by using `MLTransform`, create instances of data processing transforms with `columns` as input parameters. The data in the specified `columns` is transformed and outputted to the `beam.Row` object.
+
+The following example demonstrates how to use `MLTransform` to normalize your data between 0 and 1 by using the minimum and maximum values from your entire dataset. `MLTransform` uses the `ScaleTo01` transformation.
+
+
+```
+scale_to_z_score_transform = ScaleToZScore(columns=['x', 'y'])
+with beam.Pipeline() as p:
+  (data | MLTransform(write_artifact_location=artifact_location).with_transform(scale_to_z_score_transform))
+```
+
+In this example, `MLTransform` receives a value for `write_artifact_location`. `MLTransform` then uses this location value to write artifacts generated by the transform. To pass the data processing transform, you can use either the with_transform method of `MLTransform` or a list.
+
+```
+MLTransform(transforms=transforms, write_artifact_location=write_artifact_location)
+```
+
+The transforms passed to `MLTransform` are applied sequentially on the dataset. `MLTransform` expects a dictionary and return a transformed Row objecst with numpy arrays.
+## Examples
+
+The following examples demonstrate how to to create pipelines that use `MLTransform` to preprocess data.
+
+MLTransform can do a full pass on the dataset, which is useful when you need to transform a single element only after analyzing the entire dataset.

Review Comment:
   ```suggestion
   `MLTransform` can do a full pass on the dataset, which is useful when you need to transform a single element only after analyzing the entire dataset.
   ```



##########
website/www/site/content/en/documentation/transforms/python/elementwise/mltransform.md:
##########
@@ -0,0 +1,120 @@
+---
+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>
+
+
+Use `MLTransform` to apply common machine learning (ML) processing tasks on keyed data. Apache Beam provides ML data processing transformations that you can use with `MLTransform`. For the full list of available data
+processing transformations, see the [tft.py file](https://github.com/apache/beam/blob/ab93fb1988051baac6c3b9dd1031f4d68bd9a149/sdks/python/apache_beam/ml/transforms/tft.py#L52) in GitHub.
+
+
+To define a data processing transformation by using `MLTransform`, create instances of data processing transforms with `columns` as input parameters. The data in the specified `columns` is transformed and outputted to the `beam.Row` object.
+
+The following example demonstrates how to use `MLTransform` to normalize your data between 0 and 1 by using the minimum and maximum values from your entire dataset. `MLTransform` uses the `ScaleTo01` transformation.
+
+
+```
+scale_to_z_score_transform = ScaleToZScore(columns=['x', 'y'])
+with beam.Pipeline() as p:
+  (data | MLTransform(write_artifact_location=artifact_location).with_transform(scale_to_z_score_transform))
+```
+
+In this example, `MLTransform` receives a value for `write_artifact_location`. `MLTransform` then uses this location value to write artifacts generated by the transform. To pass the data processing transform, you can use either the with_transform method of `MLTransform` or a list.
+
+```
+MLTransform(transforms=transforms, write_artifact_location=write_artifact_location)
+```
+
+The transforms passed to `MLTransform` are applied sequentially on the dataset. `MLTransform` expects a dictionary and return a transformed Row objecst with numpy arrays.
+## Examples
+
+The following examples demonstrate how to to create pipelines that use `MLTransform` to preprocess data.
+
+MLTransform can do a full pass on the dataset, which is useful when you need to transform a single element only after analyzing the entire dataset.
+The first two examples require a full pass over the dataset to complete the data transformation.
+
+* For the `ComputeAndApplyVocabulary` transform, the transform needs access to all of the unique words in the dataset.
+* For the `ScaleTo01` transform, the transform needs to know the minimum and maximum values in the dataset.
+
+### Example 1
+
+This example creates a pipeline that uses `MLTransform` to scale data between 0 and 1.
+The example takes a list of ints and converts them into the range of 0 to 1 using the transform `ScaleTo01`.

Review Comment:
   ```suggestion
   The example takes a list of integers and converts them into the range of 0 to 1 using the transform `ScaleTo01`.
   ```



##########
website/www/site/content/en/documentation/transforms/python/elementwise/mltransform.md:
##########
@@ -0,0 +1,120 @@
+---
+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>
+
+
+Use `MLTransform` to apply common machine learning (ML) processing tasks on keyed data. Apache Beam provides ML data processing transformations that you can use with `MLTransform`. For the full list of available data
+processing transformations, see the [tft.py file](https://github.com/apache/beam/blob/ab93fb1988051baac6c3b9dd1031f4d68bd9a149/sdks/python/apache_beam/ml/transforms/tft.py#L52) in GitHub.
+
+
+To define a data processing transformation by using `MLTransform`, create instances of data processing transforms with `columns` as input parameters. The data in the specified `columns` is transformed and outputted to the `beam.Row` object.
+
+The following example demonstrates how to use `MLTransform` to normalize your data between 0 and 1 by using the minimum and maximum values from your entire dataset. `MLTransform` uses the `ScaleTo01` transformation.
+
+
+```
+scale_to_z_score_transform = ScaleToZScore(columns=['x', 'y'])
+with beam.Pipeline() as p:
+  (data | MLTransform(write_artifact_location=artifact_location).with_transform(scale_to_z_score_transform))
+```
+
+In this example, `MLTransform` receives a value for `write_artifact_location`. `MLTransform` then uses this location value to write artifacts generated by the transform. To pass the data processing transform, you can use either the with_transform method of `MLTransform` or a list.
+
+```
+MLTransform(transforms=transforms, write_artifact_location=write_artifact_location)
+```
+
+The transforms passed to `MLTransform` are applied sequentially on the dataset. `MLTransform` expects a dictionary and return a transformed Row objecst with numpy arrays.
+## Examples
+
+The following examples demonstrate how to to create pipelines that use `MLTransform` to preprocess data.
+
+MLTransform can do a full pass on the dataset, which is useful when you need to transform a single element only after analyzing the entire dataset.
+The first two examples require a full pass over the dataset to complete the data transformation.
+
+* For the `ComputeAndApplyVocabulary` transform, the transform needs access to all of the unique words in the dataset.
+* For the `ScaleTo01` transform, the transform needs to know the minimum and maximum values in the dataset.
+
+### Example 1
+
+This example creates a pipeline that uses `MLTransform` to scale data between 0 and 1.
+The example takes a list of ints and converts them into the range of 0 to 1 using the transform `ScaleTo01`.
+
+{{< 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 >}}
+
+
+### Example 2
+
+This example creates a pipeline that use `MLTransform` to compute vocabulary on the entire dataset and assign indices to each unique vocabulary item.
+It takes a list of strings, computes vocabulary over the entire dataset, and then applies a unique index to each vocabulary item.
+
+
+{{< 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_compute_and_apply_vocabulary >}}
+{{</ 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_compute_and_apply_vocab >}}
+{{< /highlight >}}
+
+
+The above two examples requires a full pass over the dataset to transform the dataset. For `ComputeAndApplyVocabulary`, all the unqiue words in the dataset needs to be known before transforming the data. For `ScaleTo01`, the minimum and maximum of the dataset needs to be known before transforming the dataset. This is acheived by `MLTransform`.

Review Comment:
   ```suggestion
   ```
   Delete this, because it's been moved to the intro.



-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] rszper commented on pull request #27709: [WIP] MLTransform transform catalog snippets

Posted by "rszper (via GitHub)" <gi...@apache.org>.
rszper commented on PR #27709:
URL: https://github.com/apache/beam/pull/27709#issuecomment-1659014733

   We'll also need to add this to the table in the Overview page: https://beam.apache.org/documentation/transforms/python/overview/
   
   And to the TOC: https://github.com/apache/beam/blob/3d501ee9dc208af2efef009daa98c49819b73ddc/website/www/site/layouts/partials/section-menu/en/documentation.html


-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] rszper commented on a diff in pull request #27709: MLTransform transform catalog snippets

Posted by "rszper (via GitHub)" <gi...@apache.org>.
rszper commented on code in PR #27709:
URL: https://github.com/apache/beam/pull/27709#discussion_r1280925325


##########
website/www/site/content/en/documentation/transforms/python/overview.md:
##########
@@ -27,6 +27,7 @@ limitations under the License.
   <tr><td><a href="/documentation/transforms/python/elementwise/keys">Keys</a></td><td>Extracts the key from each element in a collection of key-value pairs.</td></tr>
   <tr><td><a href="/documentation/transforms/python/elementwise/kvswap">KvSwap</a></td><td>Swaps the key and value of each element in a collection of key-value pairs.</td></tr>
   <tr><td><a href="/documentation/transforms/python/elementwise/map">Map</a></td><td>Applies a function to every element in the input and outputs the result.</td></tr>
+  <tr><td><a href="/documentation/transforms/python/elementwise/mltransform">MLTransform</a></td><td>Applies Data processing transforms on the dataset.</td></tr>

Review Comment:
   ```suggestion
     <tr><td><a href="/documentation/transforms/python/elementwise/mltransform">MLTransform</a></td><td>Applies data processing transforms to the dataset.</td></tr>
   ```



##########
website/www/site/layouts/partials/section-menu/en/documentation.html:
##########
@@ -291,6 +291,7 @@
             <li><a href="/documentation/transforms/python/elementwise/keys/">Keys</a></li>
             <li><a href="/documentation/transforms/python/elementwise/kvswap/">KvSwap</a></li>
             <li><a href="/documentation/transforms/python/elementwise/map/">Map</a></li>
+            <li><a href="/documentation/transforms/python/elementwise/mltransform/">Map</a></li>

Review Comment:
   ```suggestion
               <li><a href="/documentation/transforms/python/elementwise/mltransform/">MLTransform</a></li>
   ```



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

Review Comment:
   ```suggestion
   Use `MLTransform` to apply common machine learning (ML) processing tasks on keyed data. Apache Beam provides ML data processing transformations that you can use with `MLTransform`. For the full list of available data
   ```



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

Review Comment:
   ```suggestion
   processing transformations, see the [tft.py file](https://github.com/apache/beam/blob/ab93fb1988051baac6c3b9dd1031f4d68bd9a149/sdks/python/apache_beam/ml/transforms/tft.py#L52) in GitHub.
   ```



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

Review Comment:
   ```suggestion
   The following example demonstrates how to use `MLTransform` to normalize your data between 0 and 1 by using the minimum and maximum values from your entire dataset. `MLTransform` uses the `ScaleTo01` transformation.
   
   ```



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

Review Comment:
   ```suggestion
   In this example, `MLTransform` receives a value for `artifact_location`. `MLTransform` then uses this location value to store artifacts generated by the transform. To pass the data processing transform, you can use either the with_transform` method of `MLTransform` or a list.
   ```



##########
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).

Review Comment:
   ```suggestion
   The transforms passed to `MLTransform` are applied sequentially on the dataset. `MLTransform` expects keyed data (Link to the supported inputs).
   ```



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

Review Comment:
   ```suggestion
   This example creates a pipeline that uses `MLTransform` to scale data between 0 and 1.
   The example takes a list of ints and converts them into the range of 0 to 1 using the transform `ScaleTo01`.
   ```



##########
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`.

Review Comment:
   Remove; I moved this content to the intro.



##########
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
+
+In the example, we will create a pipeline that use MLTransform to compute vocabulary on the entire dataset and assign indices to each unique vocab.

Review Comment:
   ```suggestion
   This example creates a pipeline that use `MLTransform` to compute vocabulary on the entire dataset and assign indices to each unique vocabulary item.
   It takes a list of strings, computes vocabulary over the entire dataset, and then applies a unique index to each vocabulary item.
   ```



##########
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
+
+In the example, we will create a pipeline that use MLTransform to compute vocabulary on the entire dataset and assign indices to each unique vocab.
+
+{{< 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_compute_and_apply_vocabulary >}}
+{{</ 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_compute_and_apply_vocabulary >}}
+{{< /highlight >}}
+
+
+This example takes a list of strings, computes vocab over the entire dataset and applies a unique index to each vocab.
+
+
+The above two examples requires a full pass over the dataset to transform the dataset. For `ComputeAndApplyVocabulary`, all the unqiue words in the dataset needs to be known before transforming the data. For `ScaleTo01`, the minimum and maximum of the dataset needs to be known before transforming the dataset. This is acheived by `MLTransform`.
+
+
+In this example, we will create a pipeline that use MLTransform to compute vocabulary on the entire dataset and assign indices to each unique vocab. This pipeline takes a single element as input instead of list of elements.

Review Comment:
   ```suggestion
   This example creates a pipeline that uses `MLTransform` to compute vocabulary on the entire dataset and assign indices to each unique vocabulary item. This pipeline takes a single element as input instead of a list of elements.
   ```



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

Review Comment:
   If we include this example on this page, it should be in the example section and formatted to match the other examples on the page.



##########
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).
+

Review Comment:
   ```suggestion
   ## Examples
   
   The following examples demonstrate how to to create pipelines that use `MLTransform` to preprocess data.
   
   MLTransform can do a full pass on the dataset, which is useful when you need to transform a single element only after analyzing the entire dataset.
   The first two examples require a full pass over the dataset to complete the data transformation.
   
   * For the `ComputeAndApplyVocabulary` transform, the transform needs access to all of the unique words in the dataset.
   * For the `ScaleTo01` transform, the transform needs to know the minimum and maximum values in the dataset.
   ```



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

Review Comment:
   ```suggestion
   ### Example 1
   ```



##########
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
+
+In the example, we will create a pipeline that use MLTransform to compute vocabulary on the entire dataset and assign indices to each unique vocab.
+
+{{< 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_compute_and_apply_vocabulary >}}
+{{</ 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_compute_and_apply_vocabulary >}}
+{{< /highlight >}}
+
+
+This example takes a list of strings, computes vocab over the entire dataset and applies a unique index to each vocab.

Review Comment:
   Remove; I moved this content to the intro.



##########
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
+
+In the example, we will create a pipeline that use MLTransform to compute vocabulary on the entire dataset and assign indices to each unique vocab.
+
+{{< 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_compute_and_apply_vocabulary >}}
+{{</ 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_compute_and_apply_vocabulary >}}
+{{< /highlight >}}
+
+
+This example takes a list of strings, computes vocab over the entire dataset and applies a unique index to each vocab.
+
+
+The above two examples requires a full pass over the dataset to transform the dataset. For `ComputeAndApplyVocabulary`, all the unqiue words in the dataset needs to be known before transforming the data. For `ScaleTo01`, the minimum and maximum of the dataset needs to be known before transforming the dataset. This is acheived by `MLTransform`.
+

Review Comment:
   ```suggestion
   ### Example 3
   ```



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

Review Comment:
   ```suggestion
   To define a data processing transformation by using `MLTransform`, create instances of data processing transforms with `columns` as input parameters. The data in the specified `columns` is transformed and outputted to the `beam.Row` object.
   ```



##########
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
+
+In the example, we will create a pipeline that use MLTransform to compute vocabulary on the entire dataset and assign indices to each unique vocab.
+
+{{< 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_compute_and_apply_vocabulary >}}
+{{</ 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_compute_and_apply_vocabulary >}}
+{{< /highlight >}}
+
+
+This example takes a list of strings, computes vocab over the entire dataset and applies a unique index to each vocab.
+
+
+The above two examples requires a full pass over the dataset to transform the dataset. For `ComputeAndApplyVocabulary`, all the unqiue words in the dataset needs to be known before transforming the data. For `ScaleTo01`, the minimum and maximum of the dataset needs to be known before transforming the dataset. This is acheived by `MLTransform`.

Review Comment:
   Remove; I moved this content to the intro of the Example section.



-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] rszper commented on a diff in pull request #27709: MLTransform transform catalog snippets

Posted by "rszper (via GitHub)" <gi...@apache.org>.
rszper commented on code in PR #27709:
URL: https://github.com/apache/beam/pull/27709#discussion_r1280935659


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

Review Comment:
   If we include this example on this page, it should be in the example section and formatted to match the other examples on the page. We also use this example in the conceptual page that I'm working on; we probably don't need it in both places. This page should be reference content, whereas the page I'm working on is more focused on conceptual content.



-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] codecov[bot] commented on pull request #27709: [WIP] MLTransform transform catalog

Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #27709:
URL: https://github.com/apache/beam/pull/27709#issuecomment-1653643006

   ## [Codecov](https://app.codecov.io/gh/apache/beam/pull/27709?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   > Merging [#27709](https://app.codecov.io/gh/apache/beam/pull/27709?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) (c9945e8) into [master](https://app.codecov.io/gh/apache/beam/commit/d822fc9a1d31f969b8fcc395f400642328d5ddaa?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) (d822fc9) will **decrease** coverage by `0.03%`.
   > Report is 20 commits behind head on master.
   > The diff coverage is `0.00%`.
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #27709      +/-   ##
   ==========================================
   - Coverage   70.93%   70.90%   -0.03%     
   ==========================================
     Files         861      862       +1     
     Lines      104807   104848      +41     
   ==========================================
   - Hits        74344    74343       -1     
   - Misses      28905    28947      +42     
     Partials     1558     1558              
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | python | `79.96% <0.00%> (-0.05%)` | :arrow_down: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Files Changed](https://app.codecov.io/gh/apache/beam/pull/27709?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [...les/snippets/transforms/elementwise/mltransform.py](https://app.codecov.io/gh/apache/beam/pull/27709?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c2Rrcy9weXRob24vYXBhY2hlX2JlYW0vZXhhbXBsZXMvc25pcHBldHMvdHJhbnNmb3Jtcy9lbGVtZW50d2lzZS9tbHRyYW5zZm9ybS5weQ==) | `0.00% <0.00%> (ø)` | |
   
   ... and [10 files with indirect coverage changes](https://app.codecov.io/gh/apache/beam/pull/27709/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   
   :mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   


-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] github-actions[bot] commented on pull request #27709: MLTransform transform catalog snippets

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #27709:
URL: https://github.com/apache/beam/pull/27709#issuecomment-1661548403

   Assigning reviewers. If you would like to opt out of this review, comment `assign to next reviewer`:
   
   R: @damccorm for label python.
   
   Available commands:
   - `stop reviewer notifications` - opt out of the automated review tooling
   - `remind me after tests pass` - tag the comment author after tests pass
   - `waiting on author` - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)
   
   The PR bot will only process comments in the main thread (not review comments).


-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] AnandInguva merged pull request #27709: MLTransform transform catalog snippets

Posted by "AnandInguva (via GitHub)" <gi...@apache.org>.
AnandInguva merged PR #27709:
URL: https://github.com/apache/beam/pull/27709


-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org