model_card_toolkit.QuantitativeAnalysis

The quantitative analysis of a model.

Inherits From: BaseModelCardField

Identify relevant performance metrics and display values. Let’s say you’re interested in displaying the accuracy and false positive rate (FPR) of a cat vs. dog classification model. Assuming you have already computed both metrics, both overall and per-class, you can specify metrics like so:

model_card.quantitative_analysis.performance_metrics = [
  {'type': 'accuracy', 'value': computed_accuracy},
  {'type': 'accuracy', 'value': cat_accuracy, 'slice': 'cat'},
  {'type': 'accuracy', 'value': dog_accuracy, 'slice': 'dog'},
  {'type': 'fpr', 'value': computed_fpr},
  {'type': 'fpr', 'value': cat_fpr, 'slice': 'cat'},
  {'type': 'fpr', 'value': dog_fpr, 'slice': 'dog'},
]

performance_metrics The performance metrics being reported.
graphics A collection of visualizations of model performance.

Methods

clear

View source

Clear the subfields of this BaseModelCardField.

copy_from_proto

View source

Copies the contents of the model card proto into current object.

merge_from_proto

View source

Merges the contents of the model card proto into current object.

to_dict

View source

Convert your model card to a python dictionary.

to_json

View source

Convert this class object to json.

to_proto

View source

Convert this class object to the proto.

__eq__

__len__

View source

Returns the number of items in a field. Ignores None values recursively, so the length of a field that only contains another field that has all None values would be 0.