in flsim/common/diversity_metrics.py [0:0]
def _get_metrics_of_interest(self, other) -> Tuple[float, float]:
# For comparison, the two objects must have the same metric of interest
assert self.diversity_metric_type == other.diversity_metric_type
v1 = self._recpr_gradient_diversity
v2 = other._recpr_gradient_diversity
if self.diversity_metric_type == DiversityMetricType.orthogonality:
v1 = self._recpr_orthogonality
v2 = other._recpr_orthogonality
elif self.diversity_metric_type == DiversityMetricType.delta_norm_sq:
# Use negatives for comparison, since internal comparators are flipped
v1 = -self.delta_norm_sq
v2 = -other.delta_norm_sq
elif self.diversity_metric_type == DiversityMetricType.sum_client_delta_norm_sq:
# Use negatives for comparison, since internal comparators are flipped
v1 = -self.sum_client_delta_norm_sq
v2 = -other.sum_client_delta_norm_sq
elif (
self.diversity_metric_type
== DiversityMetricType.sum_client_delta_mutual_angles
):
# Use negatives for comparison, since internal comparators are flipped
v1 = -self.sum_client_delta_mutual_angles
v2 = -other.sum_client_delta_mutual_angles
return v1, v2