apache_beam.ml.inference.api module

class apache_beam.ml.inference.api.PredictionResult(example: ~_INPUT_TYPE, inference: ~_OUTPUT_TYPE)[source]

Bases: object

class apache_beam.ml.inference.api.RunInference(model_loader: apache_beam.ml.inference.base.ModelLoader)[source]

Bases: apache_beam.transforms.ptransform.PTransform

A transform that takes a PCollection of examples (or features) to be used on an ML model. It will then output inferences (or predictions) for those examples in a PCollection of PredictionResults, containing the input examples and output inferences.

If examples are paired with keys, it will output a tuple (key, PredictionResult) for each (key, example) input.

Models for supported frameworks can be loaded via a URI. Supported services can also be used.

TODO(BEAM-14046): Add and link to help documentation

expand(pcoll: apache_beam.pvalue.PCollection) → apache_beam.pvalue.PCollection[source]