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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
