INNER CODE UNIT · Python

_predict

GoogleCloudPlatform/vertex-ai-samples · community-content/tf_agents_bandits_movie_recommendation_with_kfp_and_vertex_sdk/mlops_pipeline_tf_agents_bandits_movie_recommendation/src/prediction_container/main.py:100

def _predict(
    instances: List[Dict[str, List[List[float]]]],
    trained_policy: policies.TFPolicy) -> Dict[str, List[Dict[str, List[int]]]]:
  """Gets predictions for the observations in `instances`; triggers the Logger.

  Unpacks observations in `instances` and queries the trained policy for
  predicted actions. Triggers the Logger with observations and predicted
  actions.

  Args:
    instances: List of `{"observation": <observation>}` for which to generate
      predictions.
    trained_policy: Trained policy to generate predictions.

  Returns:
    A dict with the key "predictions" mapping to a list of predicted actions
    corresponding to each observation in the prediction request.
  """

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…