bacpipe.embedding_evaluation.visualization.visualize_predictions

Functions

load_results(path_func, task, model_list)

Load the task results into a dict and return them.

plot_classification_heatmap(event, ...[, ...])

plot_classification_results(task_name[, ...])

Save model specific classification results in the model specific plot path, displayed as horizontal bars.

plot_per_class_metrics(plot_path, task_name, ...)

Visualization of per class results.

prepare_probe_inference(model[, probe_path])

Load a linear probe that was previously trained and saved.

run_probe_inference(model, linear_probe, ...)

Apply a previously trained linear probe to data.

Classes

Figure([figsize, dpi, facecolor, edgecolor, ...])

The top level container for all the plot elements.

Path(*args, **kwargs)

PurePath subclass that can make system calls.

PredictionsLoader(vis_loader, path_func, ...)

SpectrogramPlot(audio_dir, loader, ...)

class bacpipe.embedding_evaluation.visualization.visualize_predictions.PredictionsLoader(vis_loader, path_func, models, panel_selection, progress_bar, loading_pane, thresh=0.5)[source]

Bases: object

accumulate_data(species, accumulate_by='day')[source]
get_classes(path)[source]
get_data(model, threshold, clfier_type=None, probe_path='', **kwargs)[source]
get_timestamps_per_embedding(model)[source]
load_classification(model, threshold)[source]
static reorder_by_most_occurrance(probs, label2index)[source]
static transform_presence_into_hour_heatmap(species_presence, hours, accumulator)[source]
static verify_threshold(threshold)[source]
bacpipe.embedding_evaluation.visualization.visualize_predictions.load_results(path_func, task, model_list)[source]

Load the task results into a dict and return them. For classification multiple subtasks exist, so do them seperately.

Parameters:
  • path_func (function) – returns model specific tasks when model is given

  • task (str) – name of task

  • model_list (list) – list of models

Returns:

performance for different tasks and models

Return type:

dict

bacpipe.embedding_evaluation.visualization.visualize_predictions.plot_classification_heatmap(event, predictions_loader, model, accumulate_by, threshold, species=None, **kwargs)[source]
bacpipe.embedding_evaluation.visualization.visualize_predictions.plot_classification_results(task_name, paths=None, metrics=None, return_fig=False, path_func=None, model_name=None)[source]

Save model specific classification results in the model specific plot path, displayed as horizontal bars.

Parameters:
  • task_name (str) – name of task

  • paths (SimpleNamespace object) – path to store plots

  • metrics (dict) – classification performance

  • return_fig (bool) – if True the figure will be returned, by default False

  • path_func (function) – function to return the paths when model name is given

  • model_name (str) – name of model, by default None

Returns:

figure handle

Return type:

plt object

bacpipe.embedding_evaluation.visualization.visualize_predictions.plot_per_class_metrics(plot_path, task_name, model_list, metrics)[source]

Visualization of per class results. Resulting figure is stored in plot path. Models are sorted by the value of the first entry.

Parameters:
  • plot_path (pathlib.Path object) – path to store plot in

  • task_name (str) – name of task

  • model_list (list) – list of models

  • metrics (dict) – performance dictionary