hoops_ai.ml.metric_explorer
Classes
|
Class for exploring metrics stored in a metric file. |
- class hoops_ai.ml.metric_explorer.MetricExplorer(metric_or_flow_file_path)
Bases:
objectClass for exploring metrics stored in a metric file. It leverages an internal MetricStorage instance to load various types of metric data, and provides convenience methods for querying and post-processing those metrics.
- Parameters:
metric_or_flow_file_path (str)
- best_worst_categories(name, epoch)
Returns the best and worst performing categories for a given metric and epoch.
- compute_confusion_matrix_stats(name, epoch)
Example of a post-processing method that, if ‘name’ corresponds to a confusion matrix, computes overall accuracy or other metrics.
- get_aggregated_confusion_matrix(name, epochs)
Aggregates confusion matrices across multiple epochs by summing them.
This is useful for analyzing a “total” confusion matrix over a set of epochs rather than looking at each epoch individually.
- Parameters:
- Returns:
A NumPy array representing the summed confusion matrix, or None if invalid.
- Return type:
numpy.ndarray | None
- get_category_metric(name, epoch)
Retrieves the category labels and corresponding values for a given epoch.
- get_category_over_time(name, category_id)
Retrieves the change of a specific category’s value over all epochs for a given metric.
NOTE: This relies on the fact that each category metric is stored once with multiple epochs, categories, and values. We’ll look up all epochs from the store and return the values only for the requested category.
- get_data(name, data_id)
Retrieves the data for a given prediction. :param name: Name of the data (e.g., “face_label_prediction”). :param data_id: The data id to retrieve. :return: A dictionary with the data fields.
- Parameters:
- Return type:
- get_matrix_metric(name, epoch)
Retrieves the matrix metric for a given epoch.
- Parameters:
- Returns:
A 2D NumPy array representing the stored matrix.
- Return type:
- get_trend_metric(name)
Retrieves the epochs and values for a given trend metric.
- list_category_metrics()
Lists all available category metric names in the storage.
- list_data()
Lists all available predictions in the storage. :return: A list of prediction names.
- list_data_ids(name)
Retrieves the data ids for which predictions were made. :return: A list of data ids.
- list_matrix_metrics()
Lists all available matrix metric names in the storage.
- list_trend_metrics()
Lists all available trend metric names in the storage.
- print_table_of_content()
Prints the table of content of the metric file, organized by metric type.
- smooth_trend_metric(name, window_size=5)
Returns a smoothed version of the trend metric using a simple moving average.