qumphy.evaluate.deepensembles module

File: qumphy/uq/deepensembles.py Project: 22HLT01 QUMPHY Contact: oskar.pfeffer@ptb.de Gitlab: https://gitlab.com/qumphy Description: DeepEnsemble Trainer.

class qumphy.evaluate.deepensembles.DeepBeatEvaluation[source]

Bases: object

Evaluation utilities for DeepBeat ensemble predictions.

evaluation_function(target, predictions, ensemble_predictions)[source]

Evaluate individual DeepBeat models and ensemble predictions.

Parameters:
  • target (np.ndarray) – Ground truth target values.

  • predictions (np.ndarray) – Predictions from individual ensemble members.

  • ensemble_predictions (np.ndarray) – Aggregated ensemble predictions.

Returns:

The function prints the calculated metrics.

Return type:

None

print_metrics(mean_metrics, max_metrics, min_metrics, ensemble_metrics)[source]
reduce(predictions)[source]

mean of predictions

class qumphy.evaluate.deepensembles.DeepEnsembleEvaluate(config)[source]

Bases: object

Evaluation pipeline for deep ensemble predictions.

calculate_metrics()[source]
load_dataset()[source]

Load the dataset from the configuration.

Returns:

The function stores the dataset and target values as attributes.

Return type:

None

load_evaluation_class()[source]

Load the evaluation class from the configuration.

Returns:

The function stores the evaluation class as an attribute.

Return type:

None

load_predictions()[source]

Load and process prediction files.

Returns:

The function loads predictions, optionally applies extra processing and denormalization, and stores individual and ensemble predictions.

Return type:

None

class qumphy.evaluate.deepensembles.PulseDBEvaluation[source]

Bases: object

A class for evaluating PulseDB models and ensembles.

Contains methods for evaluating individual models and ensembles, as well as methods for printing and saving the results.

denormalize(dataset, predictions)[source]

Denormalize PulseDB predictions.

Parameters:
  • dataset (object) – Dataset object containing BP_mean and BP_std attributes.

  • predictions (np.ndarray) – Normalized predictions containing mean and standard deviation values.

Returns:

Denormalized predictions.

Return type:

np.ndarray

evaluation_function(target, predictions, ensemble_predictions)[source]

Evaluate individual PulseDB models and ensemble predictions.

Parameters:
  • target (np.ndarray) – Ground truth blood pressure targets.

  • predictions (np.ndarray) – Predictions from individual ensemble members.

  • ensemble_predictions (np.ndarray) – Aggregated ensemble predictions.

Returns:

The function prints the calculated metrics.

Return type:

None

extra_function(predictions)[source]

Convert predicted log-variances to standard deviations.

Parameters:

predictions (np.ndarray) – Prediction array containing mean values and log-variance values.

Returns:

Prediction array containing mean values and standard deviation values.

Return type:

np.ndarray

print_metrics(mean_metrics, max_metrics, min_metrics, ensemble_metrics)[source]
reduce(predictions)[source]

GAUSSIAN MIXTURE AS IN LAKSMINARAYANAN PAPER The predictions are given as mean and std and returned the same way. :param predictions: Predictions from individual ensemble members. :type predictions: np.ndarray

Returns:

Aggregated ensemble prediction.

Return type:

np.ndarray

qumphy.evaluate.deepensembles.append_nested_dicts(dicts_list)[source]

Take a list of nested dictionaries and create a single dictionary with the values replaced by arrays of the values of the individual dictionaries. The dictionaries must have the same structure.

qumphy.evaluate.deepensembles.reduce_nested_dict_list(dicts_list, reduction_function)[source]

Take a list of nested dictionaries and reduce them to a single dictionary using the given reduction function. The dictionaries must have the same structure.

Parameters:
  • dicts_list (list) – List of nested dictionaries.

  • reduction_function (function, optional) – Function to use for reduction.

Returns:

Reduced dictionary.

Return type:

dict