Lightning Components
- class InnerEye.ML.lightning_metrics.Accuracy05(*args: Any, **kwargs: Any)[source]
- correct: Tensor
- property has_predictions: bool
Returns True if the present object stores at least 1 prediction (self.update has been called at least once), or False if no predictions are stored.
- total: Tensor
- class InnerEye.ML.lightning_metrics.AccuracyAtOptimalThreshold[source]
Computes the binary classification accuracy at an optimal cut-off point.
- class InnerEye.ML.lightning_metrics.AreaUnderPrecisionRecallCurve[source]
Computes the area under the precision-recall-curve.
- class InnerEye.ML.lightning_metrics.AreaUnderRocCurve[source]
Computes the area under the receiver operating curve (ROC).
- class InnerEye.ML.lightning_metrics.AverageWithoutNan(dist_sync_on_step: bool = False, name: str = '')[source]
A generic metric computer that keep track of the average of all values excluding those that are NaN.
- class InnerEye.ML.lightning_metrics.BinaryCrossEntropyWithLogits[source]
Computes the cross entropy for binary classification. This metric must be computed off the model output logits.
- class InnerEye.ML.lightning_metrics.ExplainedVariance(*args: Any, **kwargs: Any)[source]
- property has_predictions: bool
Returns True if the present object stores at least 1 prediction (self.update has been called at least once), or False if no predictions are stored.
- n_obs: Tensor
- sum_error: Tensor
- sum_squared_error: Tensor
- sum_squared_target: Tensor
- sum_target: Tensor
- class InnerEye.ML.lightning_metrics.FalseNegativeRateOptimalThreshold[source]
Computes the false negative rate when choosing the optimal cut-off point for a binary classifier.
- class InnerEye.ML.lightning_metrics.FalsePositiveRateOptimalThreshold[source]
Computes the false positive rate when choosing the optimal cut-off point for a binary classifier.
- class InnerEye.ML.lightning_metrics.MeanAbsoluteError(*args: Any, **kwargs: Any)[source]
- property has_predictions: bool
Returns True if the present object stores at least 1 prediction (self.update has been called at least once), or False if no predictions are stored.
- sum_abs_error: Tensor
- total: Tensor
- class InnerEye.ML.lightning_metrics.MeanSquaredError(*args: Any, **kwargs: Any)[source]
- property has_predictions: bool
Returns True if the present object stores at least 1 prediction (self.update has been called at least once), or False if no predictions are stored.
- sum_squared_error: Tensor
- total: Tensor
- class InnerEye.ML.lightning_metrics.MetricForMultipleStructures(ground_truth_ids: List[str], is_training: bool, metric_name: str = 'Dice', use_average_across_structures: bool = True)[source]
Stores a metric for multiple structures, and an average Dice score across all structures. The class consumes pre-computed metric values, and only keeps an aggregate for later computing the averages. When averaging, metric values that are NaN are skipped.
- compute_all() Iterator[Tuple[str, Tensor]][source]
Calls the .compute() method on all the metrics that the present object holds, and returns a sequence of (metric name, metric value) tuples. This will automatically also call .reset() on the metrics. The first returned metric is the average across all structures, then come the per-structure values.
- training: bool
- update(values_per_structure: Tensor) None[source]
Stores a vector of per-structure Dice scores in the present object. It updates the per-structure values, and the aggregate value across all structures.
- Parameters:
values_per_structure – A row tensor that has as many entries as there are ground truth IDs.
- class InnerEye.ML.lightning_metrics.OptimalThreshold[source]
Computes the optimal cut-off point for a binary classifier.
- class InnerEye.ML.lightning_metrics.ScalarMetricsBase(name: str = '', compute_from_logits: bool = False)[source]
A base class for all metrics that can only be computed once the complete set of model predictions and labels is available. The base class provides an update method, and synchronized storage for predictions (field preds) and labels (field targets). Derived classes need to override the compute method.
- property has_predictions: bool
Returns True if the present object stores at least 1 prediction (self.update has been called at least once), or False if no predictions are stored.
- InnerEye.ML.lightning_metrics.nanmean(values: Tensor) Tensor[source]
Computes the average of all values in the tensor, skipping those entries that are NaN (not a number). If all values are NaN, the result is also NaN.
- Parameters:
values – The values to average.
- Returns:
A scalar tensor containing the average.