INNER CODE UNIT · Python

log_prediction_to_bigquery

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

def log_prediction_to_bigquery(event: Dict[str, Any], context) -> None:  # pylint: disable=unused-argument
  """Logs prediction inputs and results to BigQuery.

  Queries the MovieLens simulation environment for rewards and other info based
  on observations and predicted actions, and logs trajectory data to BigQuery.

  Serves as the Logger and the entrypoint of Cloud Functions. The Logger closes
  the feedback loop from prediction results to training data, and allows
  re-training of the policy with new training data.

  Note: In production, this function can be modified to hold the logic of
  gathering real-world feedback for observations and predicted actions,
  formulating trajectory data, and storing back into BigQuery.

  Args:
    event: Triggering event of this function.
    context: Trigerring context of this function.
      This is of type `functions_v1.context.Context` but not specified since

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…