Artur D
Artur D

Reputation: 38

How to read Vertex AI model monitoring statistics

I've found in Google's VertexAI monitoring guide collab information (near the end of the notebook), that all model monitoring related metrics are stored in auto generated bucket called "cloud-ai-platform-". I'd like to review those and see for example data drift over time.

The problem is, I cannot find any documentation mention about it anywhere else.

I've identified the bucket related to that and tried to read them, but they are in binary format, most likely protobuf. Location looks like this: gs://cloud-ai-platform-<id>/model_monitoring/job-<id>/serving/<date>/stats_and_anomalies/<id>/stats/

I've expected to find schemas there as well somewhere so that the reader can be generated, but it's not there.

Upvotes: 1

Views: 189

Answers (1)

Try to add at the end of the file ".pb", after that:

import tensorflow_data_validation as tfdv
from tensorflow_data_validation.utils import io_util
from tensorflow_metadata.proto.v0 import statistics_pb2

# util function to load stats binary file from GCS
def load_stats_binary(input_path):
    stats_proto = statistics_pb2.DatasetFeatureStatisticsList()
    stats_proto.ParseFromString(
        io_util.read_file_to_string(input_path, binary_mode=True)
    )
    return stats_proto

tfdv.visualize_statistics(load_stats_binary("./training_stats.pb"))

Upvotes: 0

Related Questions