INNER CODE UNIT · Python

simulate

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

def simulate(event: Dict[str, Any], context) -> None:  # pylint: disable=unused-argument
  """Gets observations and sends prediction requests to endpoints.

  Queries the MovieLens simulation environment for observations and sends
  prediction requests with the observations to the Vertex endpoint.

  Serves as the Simulator and the entrypoint of Cloud Functions.

  Note: In production, this function can be modified to hold the logic of
  gathering real-world input features as observations, getting prediction
  results from the endpoint and communicating those results to real-world
  users.

  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
      it is not importable for a local environment that wants to run unit

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…