get_metrics
Retrieves the metrics associated with one or more models. Metrics must have been added with the model when it was saved with mb.add_model or mb.add_models.
Parameters
mb.get_metrics({name_or_names})
name_or_names:Union[str, List[str]]The name(s) of the models for fetching metrics. This can be one model name (str) or a list of model names (List[str]). The input format affects the output format.
Returns
Dict[str, Any] - If this method is called with a str model name then that model's metrics, if any, are returned. If this method is called with a list of model names then a dictionary of { modelName: modelMetrics } is returned.
Examples
Get one model's metrics
Fetching the metrics for the model named example_model returns a dict of that model's metrics:
mb.get_metrics("example_model")
# returns { "metric1": 1, "metric2": 2 }
Get several models' metrics
When fetching the metrics for multiple models, the response is a dict of the model names to a dict of metrics:
mb.get_metrics(["example_model", "other_model"])
# returns
# {
# "example_model": { "metric1": 1, "metric2": 2 },
# "other_model": { ... }
# }
See also
add_metricsadd_modelget_model- Learn more about working with model metrics