def _get_scores_and_labels_ordered()

in privacy_lint/attack_results.py [0:0]


    def _get_scores_and_labels_ordered(self) -> Tuple[torch.Tensor, torch.Tensor]:
        """
        Sorts the scores from the highest to the lowest and returns
        the labels sorted by the scores.

        Notes:
            - A train sample is labeled as 1 and a test sample as 0.
        """

        scores = torch.cat([self.scores_train, self.scores_test])
        order = torch.argsort(scores, descending=True)
        scores_ordered = scores[order]

        labels = torch.cat(
            [torch.ones_like(self.scores_train), torch.zeros_like(self.scores_test)]
        )
        labels_ordered = labels[order]
        return labels_ordered, scores_ordered